Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing for causes dotnet run to hang #16

Open
OnurGumus opened this issue Apr 22, 2024 · 8 comments
Open

Missing for causes dotnet run to hang #16

OnurGumus opened this issue Apr 22, 2024 · 8 comments

Comments

@OnurGumus
Copy link

OnurGumus commented Apr 22, 2024

Hi I am basically trying to use Trulla for a large file. And build process becomes very slow for minutes. Any ideas?
Update:

When I miss for keyword as in below., dotnet run hangs
{{x in correlationTypes}}x{{end}}

When you add the for thing then it works fine
{{for x in correlationTypes}}x{{end}}

@OnurGumus
Copy link
Author

And I think the problem is with your parser, I tried both F# and C# stuff. They are both very slow.

@SchlenkR
Copy link
Owner

You have an example?

@OnurGumus
Copy link
Author

<tr hx-include="this" hx-swap="outerHTML" hx-vals='{"{{phasesCombination.Key}}": "{{phasesCombination.Value}}"}'>
    <td><label>{{saturationNumber}}<input hidden name="SaturationNumber" value="{{saturationNumber}}"/></label></td>
    <td><label>{{property}}<input hidden name="Property" value="{{property}}"/></label></td>
    <td>
        <select
            class="select"
            name="Distribution"
            hx-put="{{uri}}"
            hx-target="closest tr"
            hx-include="closest tr">
            {{x in options}}x{{end}}
        </select>
    </td>
    <td>
        <input
            name="Mean"
            placeholder="Mean"
            type="number"
            value="{{mean}}"
            hx-put="{{uri}}"
            hx-target="closest tr"
            hx-include="closest tr"/>
    </td>
    <td>
        <input
            name="StandardDeviation"
            placeholder="Standard Deviation"
            type="number"
            value="{{standardDeviation}}"
            {{if isConstant}}disabled{{end}}
            hx-put="{{uri}}"
            hx-target="closest tr"
            hx-include="closest tr"/>
    </td>
    <td>
        <input
            name="LowerBound"
            placeholder="Lower Bound"
            type="number"
            value="{{lowerBound}}"
            {{if isConstant}}disabled{{end}}
            hx-put="{{uri}}"
            hx-target="closest tr"
            hx-include="closest tr"/>
    </td>
    <td>
        <input
            name="UpperBound"
            placeholder="Upper Bound"
            type="number"
            value="{{upperBound}}"
            {{if isConstant}}disabled{{end}}
            hx-put="{{uri}}"
            hx-target="closest tr"
            hx-include="closest tr"/>
    </td>
    <td>
        <select
            class="select"
            name="DependentProperty"
            {{if isConstant}}disabled{{end}}
            hx-put="{{uri}}"
            hx-target="closest tr"
            hx-include="closest tr">
            {{x in dependentProperties}}x{{end}}
        </select>
    </td>
    <td>
        <select
            class="select"
            name="CorrelationType"
            {{if isNoDependency}}disabled{{end}}
            hx-put="{{uri}}"
            hx-target="closest tr"
            hx-include="closest tr">
            {{x in correlationTypes}}x{{end}}
        </select>
    </td>
</tr>

@OnurGumus
Copy link
Author

By slow what I mean is running
dotnet run takes minutes from command line

@OnurGumus
Copy link
Author

And here's some profiling stack trace

[Trulla.DesignTime] ProviderImplementation.ProvidedTypes.TypeProviderForNamespaces::Microsoft.FSha▒
+   52,25%     0,00%  [JIT] tid 90934              [.] instance class ProviderImplementation.ProvidedTypes.ProvidedTypeDefinition [Trulla.DesignTime] <StartupCode$Trulla-DesignTime>.$ProvidedTy▒
+   52,25%     0,00%  [JIT] tid 90934              [.] class ProviderImplementation.ProvidedTypes.ProvidedTypeDefinition [Trulla.DesignTime] Trulla.DesignTime.Internal.ProviderCompiler::createT▒
+   52,25%     0,00%  [JIT] tid 90934              [.] instance valuetype TheBlunt/ParserResult`1<class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<valuetype TheBlunt/PVal`1<class Tr▒
+   52,25%     0,00%  [JIT] tid 90934              [.] instance valuetype TheBlunt/ParserResult`1<class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<valuetype TheBlunt/PVal`1<class Tr▒
+   49,95%     0,22%  [JIT] tid 90934              [.] instance valuetype TheBlunt/ParserResult`1<class [netstandard]System.Tuple`2<class Trulla.Core.Token,string>> [Trulla.DesignTime] Trulla.C▒
+   43,37%     0,13%  [JIT] tid 90934              [.] instance valuetype TheBlunt/ParserResult`1<class Trulla.Core.Token> [Trulla.DesignTime] Trulla.Core.Parsing+Internal+templateExp@96-8::I

@OnurGumus
Copy link
Author

@SchlenkR It seems I was able to narrow down the problem. Notice above code is missing the for keyword.
{{x in correlationTypes}}x{{end}}

If you use like above then it gets stuck when you do dotnet run
When you add the for thing then it works fine

{{for x in correlationTypes}}x{{end}}

While admit this is a bug on our case, the error handling can be improved. Will update the title.

@OnurGumus OnurGumus changed the title Trulla is slow with large files Missing for causes dotnet run to hang Apr 23, 2024
@SchlenkR
Copy link
Owner

Oh, that's so nice, thanks for your work. I'll have a look at it soon! How urgent is the issue for you? Blocker in important work or so?

@OnurGumus
Copy link
Author

Thanks, I guess so far, we don't have any problems as long as we adhere to the proper syntax.

Having that said, my concern is if this issue manifests itself in a different way in the future, then it might be bad :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants