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

Treewide: Basic polymorphic refactoring #849

Merged
merged 9 commits into from
Feb 14, 2021

Conversation

Anton-Latukha
Copy link
Collaborator

@Anton-Latukha Anton-Latukha commented Feb 10, 2021

Because top-level signatures are constant - polymorphism inside them should be inferred to concrete types, so after inference top-level functions binary code should be pretty much the same as also compiled performance result.

There are some `(:|)` use. I looked carefully, but there still can be something,
expecially in Repl or test parts of the code.

The `mempty` of the left hand side should not be present.

Also specially checked the shadowing case with: {-# OPTIONS_GHC
-fno-warn-name-shadowing #-}, where were none.
@Anton-Latukha Anton-Latukha force-pushed the 2021-02-10-upd-polymorphic-base-refactor branch from bf3069e to 3d77123 Compare February 10, 2021 12:04
Replaced only where the `(Semigroup a => Maybe a)` is already present,
so does not change the signatures.
@Anton-Latukha Anton-Latukha force-pushed the 2021-02-10-upd-polymorphic-base-refactor branch from 3d77123 to 8152874 Compare February 10, 2021 12:11
@Anton-Latukha
Copy link
Collaborator Author

Anton-Latukha commented Feb 10, 2021

Benchmarks:

diff -y \
master.log                                                                                                refactor.log

Build profile: -w ghc-8.10.3 -O1				Build profile: -w ghc-8.10.3 -O1
In order, the following will be built (use -v for more detail	In order, the following will be built (use -v for more detail
 - hnix-0.12.0.1 (bench:hnix-benchmarks) (first run)		 - hnix-0.12.0.1 (bench:hnix-benchmarks) (first run)
Preprocessing benchmark 'hnix-benchmarks' for hnix-0.12.0.1..	Preprocessing benchmark 'hnix-benchmarks' for hnix-0.12.0.1..
Building benchmark 'hnix-benchmarks' for hnix-0.12.0.1..	Building benchmark 'hnix-benchmarks' for hnix-0.12.0.1..
Running 1 benchmarks...						Running 1 benchmarks...
Benchmark hnix-benchmarks: RUNNING...				Benchmark hnix-benchmarks: RUNNING...
benchmarking Parser/nixpkgs-all-packages.nix			benchmarking Parser/nixpkgs-all-packages.nix
time                 188.5 ms   (181.5 ms .. 197.4 ms)	      |	time                 191.3 ms   (184.0 ms .. 199.4 ms)
                     0.999 R²   (0.997 R² .. 1.000 R²)	      |	                     0.999 R²   (0.998 R² .. 1.000 R²)
mean                 195.4 ms   (191.6 ms .. 205.4 ms)	      |	mean                 195.0 ms   (191.7 ms .. 204.2 ms)
std dev              7.930 ms   (1.684 ms .. 11.07 ms)	      |	std dev              7.397 ms   (845.0 μs .. 10.42 ms)
variance introduced by outliers: 14% (moderately inflated)	variance introduced by outliers: 14% (moderately inflated)

benchmarking Parser/nixpkgs-all-packages-pretty.nix		benchmarking Parser/nixpkgs-all-packages-pretty.nix
time                 1.920 ms   (1.909 ms .. 1.928 ms)	      |	time                 1.917 ms   (1.907 ms .. 1.929 ms)
                     1.000 R²   (1.000 R² .. 1.000 R²)	      |                      1.000 R²   (1.000 R² .. 1.000 R²)
mean                 1.918 ms   (1.912 ms .. 1.925 ms)	      |	mean                 1.905 ms   (1.900 ms .. 1.911 ms)
std dev              22.02 μs   (15.85 μs .. 35.43 μs)	      |	std dev              18.10 μs   (14.35 μs .. 23.58 μs)

benchmarking Parser/let-comments.nix				benchmarking Parser/let-comments.nix
time                 94.32 μs   (94.15 μs .. 94.51 μs)	      |	time                 94.18 μs   (94.00 μs .. 94.38 μs)
                     1.000 R²   (1.000 R² .. 1.000 R²)	      |                      1.000 R²   (1.000 R² .. 1.000 R²)
mean                 94.28 μs   (94.09 μs .. 94.51 μs)	      |	mean                 94.27 μs   (94.09 μs .. 94.47 μs)
std dev              671.8 ns   (532.1 ns .. 941.3 ns)	      |	std dev              663.4 ns   (542.9 ns .. 860.4 ns)

benchmarking Parser/let-comments-multiline.nix			benchmarking Parser/let-comments-multiline.nix
time                 107.6 μs   (107.4 μs .. 107.8 μs)	      | time                 107.6 μs   (107.4 μs .. 107.8 μs)
                     1.000 R²   (1.000 R² .. 1.000 R²)	      |                      1.000 R²   (1.000 R² .. 1.000 R²)
mean                 107.6 μs   (107.5 μs .. 107.8 μs)	      |	mean                 107.5 μs   (107.3 μs .. 107.6 μs)
std dev              500.3 ns   (380.0 ns .. 672.6 ns)	      |	std dev              600.5 ns   (484.8 ns .. 796.1 ns)

benchmarking Parser/let.nix					benchmarking Parser/let.nix
time                 90.49 μs   (90.30 μs .. 90.69 μs)	      |	time                 90.30 μs   (90.16 μs .. 90.41 μs)
                     1.000 R²   (1.000 R² .. 1.000 R²)	      |                      1.000 R²   (1.000 R² .. 1.000 R²)
mean                 90.36 μs   (90.18 μs .. 90.51 μs)	      |	mean                 90.27 μs   (90.11 μs .. 90.45 μs)
std dev              539.1 ns   (426.8 ns .. 723.3 ns)	      |	std dev              582.6 ns   (449.0 ns .. 777.8 ns)

benchmarking Parser/simple.nix					benchmarking Parser/simple.nix
time                 447.3 μs   (445.0 μs .. 449.5 μs)	      |	time                 444.2 μs   (442.8 μs .. 445.8 μs)
                     1.000 R²   (1.000 R² .. 1.000 R²)	      |                      1.000 R²   (1.000 R² .. 1.000 R²)
mean                 444.1 μs   (443.2 μs .. 445.2 μs)	      |	mean                 443.9 μs   (443.2 μs .. 445.4 μs)
std dev              3.545 μs   (2.674 μs .. 4.941 μs)	      |	std dev              3.327 μs   (2.418 μs .. 4.956 μs)

benchmarking Parser/simple-pretty.nix				benchmarking Parser/simple-pretty.nix
time                 445.2 μs   (444.0 μs .. 446.6 μs)	      |	time                 442.5 μs   (441.9 μs .. 443.1 μs)
                     1.000 R²   (1.000 R² .. 1.000 R²)	      |                      1.000 R²   (1.000 R² .. 1.000 R²)
mean                 445.3 μs   (444.5 μs .. 446.7 μs)	      |	mean                 443.1 μs   (442.5 μs .. 443.9 μs)
std dev              3.420 μs   (2.249 μs .. 5.604 μs)	      |	std dev              2.355 μs   (1.794 μs .. 3.410 μs)

Benchmark hnix-benchmarks: FINISH				Benchmark hnix-benchmarks: FINISH

@Anton-Latukha
Copy link
Collaborator Author

Profiling computational execution also looks equivalent.

@Anton-Latukha Anton-Latukha mentioned this pull request Feb 14, 2021
@Anton-Latukha Anton-Latukha merged commit 803af1b into master Feb 14, 2021
@Anton-Latukha Anton-Latukha deleted the 2021-02-10-upd-polymorphic-base-refactor branch February 14, 2021 09:54
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

Successfully merging this pull request may close these issues.

1 participant