Skip to content

Commit

Permalink
update to Typescript 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
olmobrutall committed May 17, 2020
1 parent 282c0d1 commit da3afe5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Signum.React/Scripts/QuickLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function asPromiseArray<T>(value: Seq<T> | Promise<Seq<T>>): Promise<T[]> {
if (!value)
return Promise.resolve([] as T[]);

if ((value as Promise<Seq<T>>).then)
if ((value as Promise<Seq<T>>).then != undefined)
return (value as Promise<Seq<T>>).then(a => asArray(a));

return Promise.resolve(asArray(value as Seq<T>))
Expand Down
2 changes: 1 addition & 1 deletion Signum.React/Scripts/ValueLineModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function ValueLineModal(p: ValueLineModalProps) {
<p>
{message === undefined ? SelectorMessage.PleaseChooseAValueToContinue.niceToString() : message}
</p>
<ValueLine ctx={ctx}
<ValueLine
formGroupStyle={props.labelText ? "Basic" : "SrOnly"} {...vlp} onChange={valueOnChanged} />
</div>
<div className="modal-footer">
Expand Down
6 changes: 3 additions & 3 deletions Signum.React/Signum.React.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TypeScriptToolsVersion>3.8</TypeScriptToolsVersion>
<TypeScriptToolsVersion>3.9</TypeScriptToolsVersion>
<TypeScriptBuildMode>true</TypeScriptBuildMode>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<Nullable>enable</Nullable>
Expand Down Expand Up @@ -34,8 +34,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.3" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="3.8.3">
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.4" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="3.9.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions Signum.Test/Signum.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

<ItemGroup>
<PackageReference Include="dotMorten.Microsoft.SqlServer.Types" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Signum.Analyzer" Version="2.7.0" />
<PackageReference Include="xunit" Version="2.4.1" />
Expand Down

5 comments on commit da3afe5

@olmobrutall
Copy link
Collaborator Author

@olmobrutall olmobrutall commented on da3afe5 May 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to Typescript 3.9.... Is MUCH faster!!!!

I've been the whole week trying to find time to update to TS 3.9. The compilation performance is probably the biggest pain point in Signum Framework right now, mainly because of Typescript.

I knew performance was the main topic of this release, so before the update I took the time to make some benchmarks compiling with TS 3.8.

I wanted to measure four different things:

  • Visual Studio Clean Build: Clean Southwind and compile Southwind again. This includes C# and Typescript code.
  • Visual Studio Rebuild after change in Navigator.tsx: Making a change in Sigum.React and see how long it takes. Also includes C# and Typescript.
  • Webpack initial build using watch: Uses transpileOnly so is typically faster.
  • Webpack change in Navigator.tsx using watch: Uses transpileOnly so is typically super fast (<1s).

I repeated each measure at least two times till I saw the results look stable.

Then I installed TS 3.9:

  1. Download an install https://marketplace.visualstudio.com/items?itemName=TypeScriptTeam.TypeScript-39 and TypeScriptToolsVersion in the *.React.csproj to 3.9 (for visual studio integration)
  2. Update nuget Microsoft.TypeScript.MSBuild to 3.8.3 (for VSCode / Continuous Integration)
  3. Update typescript / ts-loader / webpack in packages.json in Southwind.React signumsoftware/southwind@a244722#diff-68bd95866802b39d58eb29f8c9e9090f (for actual JS code generation)

and I repeated the measures again.

Here are the results:

  TS 3.8 TS 3.9 Time Reduction Speed ratio
Visual Studio Clean Build 2min 31sec 1min 30sec 41% 1,68x
Visual Studio Rebuild after change in Navigator.tsx 1min 52sec 0min 18sec 84% 6,25x
Webpack initial build using watch 21387ms 21047ms 2% 1,02x
Webpack change in Navigator.tsx using watch 816ms 81ms 0% 1,00x

You are seeing it right... a fresh compile takes now 41% time less, or is 1.68x faster. This is quite remarkable since this time is including all the C# code.
But what is more important, if you make a change in Typescript in Signum.React (most dependent one) and you compile again, now it takes 84% less time, of is FUCKING 6.25 times faster!! 🛫🛫🛫 Somehow Typescript is much smarter about rebuilds now.

Update: 😢 Looks like this numbers are exaggerated. I wasn't able to reproduce it in another project / machine

Sorry for your coffee times, no excuses anymore.
image

@MehdyKarimpour
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

@rezanos
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great update! Thanks! it was definitely worth losing coffee times 😄 😄

@olmobrutall
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad news, after doing similar measures in another application and computer, the results are not so awesome.... :(

TS 3.8 TS 3.9 Time Reduction Speed Ratio
02:05 01:47 14% 1,16x
00:24 00:22 8% 1,09x

If you can try before/after the upgrade will be awesome.

@MehdyKarimpour
Copy link
Contributor

@MehdyKarimpour MehdyKarimpour commented on da3afe5 May 18, 2020 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.