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

Instantiating builtin meanings on the fly instead of caching them (impressively bad results) #3317

Conversation

effectfully
Copy link
Contributor

This simplifies the API, but destroys performance. Here are the stats that I got for the nofib benchmarks:

clausify/formula1         49.45 ms	 48.95 ms       -1.0%
clausify/formula2         61.90 ms	 61.01 ms       -1.4%
clausify/formula3         172.0 ms	 169.4 ms       -1.5%
clausify/formula4         238.6 ms	 243.4 ms       +2.0%
clausify/formula5         1.119 s 	 1.097 s        -2.0%
knights/4x4               133.8 ms	 158.6 ms       +18.5%
knights/6x6               373.0 ms	 432.3 ms       +15.9%
knights/8x8               622.0 ms	 711.6 ms       +14.4%
primetest/05digits        89.00 ms	 124.2 ms       +39.6%
primetest/08digits        162.3 ms	 228.9 ms       +41.0%
primetest/10digits        229.0 ms	 325.9 ms       +42.3%
primetest/20digits        453.7 ms	 633.6 ms       +39.7%
primetest/30digits        656.2 ms	 916.2 ms       +39.6%
primetest/40digits        884.4 ms	 1.212 s        +37.0%
primetest/50digits        877.8 ms	 1.216 s        +38.5%
queens4x4/bt              22.25 ms	 25.24 ms       +13.4%
queens4x4/bm              28.83 ms	 32.53 ms       +12.8%
queens4x4/bjbt1           27.37 ms	 30.58 ms       +11.7%
queens4x4/bjbt2           29.26 ms	 32.81 ms       +12.1%
queens4x4/fc              68.36 ms	 73.28 ms       +7.2%
queens5x5/bt              290.4 ms	 343.5 ms       +18.3%
queens5x5/bm              328.2 ms	 365.1 ms       +11.2%
queens5x5/bjbt1           350.4 ms	 398.1 ms       +13.6%
queens5x5/bjbt2           371.1 ms	 420.6 ms       +13.3%

It gets a bit better with some additional strictness, but still utterly awful:

clausify/formula1         49.45 ms	 48.10 ms       -2.7%
clausify/formula2         61.90 ms	 60.31 ms       -2.6%
clausify/formula3         172.0 ms	 167.0 ms       -2.9%
clausify/formula4         238.6 ms	 238.7 ms       +0.0%
clausify/formula5         1.119 s 	 1.095 s        -2.1%
knights/4x4               133.8 ms	 149.6 ms       +11.8%
knights/6x6               373.0 ms	 416.8 ms       +11.7%
knights/8x8               622.0 ms	 690.9 ms       +11.1%
primetest/05digits        89.00 ms	 118.7 ms       +33.4%
primetest/08digits        162.3 ms	 218.8 ms       +34.8%
primetest/10digits        229.0 ms	 312.5 ms       +36.5%
primetest/20digits        453.7 ms	 597.6 ms       +31.7%
primetest/30digits        656.2 ms	 863.3 ms       +31.6%
primetest/40digits        884.4 ms	 1.144 s        +29.4%
primetest/50digits        877.8 ms	 1.144 s        +30.3%
queens4x4/bt              22.25 ms	 23.82 ms       +7.1%
queens4x4/bm              28.83 ms	 30.87 ms       +7.1%
queens4x4/bjbt1           27.37 ms	 29.12 ms       +6.4%
queens4x4/bjbt2           29.26 ms	 31.09 ms       +6.3%
queens4x4/fc              68.36 ms	 69.80 ms       +2.1%
queens5x5/bt              290.4 ms	 326.2 ms       +12.3%
queens5x5/bm              328.2 ms	 350.2 ms       +6.7%
queens5x5/bjbt1           350.4 ms	 379.0 ms       +8.2%
queens5x5/bjbt2           371.1 ms	 402.9 ms       +8.6%

I double-checked the results.

I'm rather surprised that such a tiny thing does this to performance. We should try using unsafe indexing as that has the potential to give us a decent boost (and people do use a[i] in C all the time, I suppose we can afford one such case).

@michaelpj
Copy link
Contributor

I guess it's somewhat surprising. I think we're just at a point where even a bit of re-computation hurts us...

@effectfully effectfully closed this Jun 7, 2021
@effectfully effectfully deleted the effectfully/evaluation/no-lookup-builtin branch June 7, 2021 13:00
@michaelpj michaelpj added the EXPERIMENT Experiments that we probably don't want to merge label Nov 26, 2021
@effectfully effectfully restored the effectfully/evaluation/no-lookup-builtin branch January 8, 2022 15:48
@effectfully effectfully deleted the effectfully/evaluation/no-lookup-builtin branch January 8, 2022 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Builtins Evaluation EXPERIMENT Experiments that we probably don't want to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants