Skip to content

parallelise using threads#1

Merged
tuzz merged 1 commit into
tuzz:mainfrom
nkanaev:threads
May 14, 2026
Merged

parallelise using threads#1
tuzz merged 1 commit into
tuzz:mainfrom
nkanaev:threads

Conversation

@nkanaev
Copy link
Copy Markdown
Contributor

@nkanaev nkanaev commented Apr 16, 2026

Hi

I wanted to say that's a great work you've done porting the original implementation to the new hardware. That truly is impressive.

I've made a small tweak to parallelize the workload across multiple threads that speeds up the computation significantly. I just wanted to share with you, feel free to close the PR if you don't like it.

Before:

Enter intial text: This autogram contains and
Initial constants: [5, 1, 2, 2, 8, 2, 2, 2, 4, 1, 1, 1, 2, 10, 12, 1, 1, 2, 7, 7, 2, 2, 4, 1, 1, 1]

Running Pangram Machine Mark II...
EUREKA! [5, 1, 2, 2, 26, 6, 2, 4, 13, 1, 1, 1, 2, 21, 16, 1, 1, 5, 27, 20, 3, 6, 9, 5, 5, 1]
This autogram contains five a's, one b, two c's, two d's, twenty-six e's, six f's, two g's, four h's, thirteen i's, one j, one k, one l, two m's, twenty-one n's, sixteen o's, one p, one q, five r's, twenty-seven s's, twenty t's, three u's, six v's, nine w's, five x's, five y's and one z.

EUREKA! [5, 1, 2, 2, 31, 5, 5, 8, 12, 1, 1, 2, 2, 18, 16, 1, 1, 6, 27, 21, 3, 7, 8, 3, 4, 1]
This autogram contains five a's, one b, two c's, two d's, thirty-one e's, five f's, five g's, eight h's, twelve i's, one j, one k, two l's, two m's, eighteen n's, sixteen o's, one p, one q, six r's, twenty-seven s's, twenty-one t's, three u's, seven v's, eight w's, three x's, four y's and one z.

Finished 6273179136 iterations in 10.38 seconds which is equivalent to 604.2 MHz.

After:

Enter intial text: This autogram contains and
Initial constants: [5, 1, 2, 2, 8, 2, 2, 2, 4, 1, 1, 1, 2, 10, 12, 1, 1, 2, 7, 7, 2, 2, 4, 1, 1, 1]

Running Pangram Machine Mark II...
EUREKA! [5, 1, 2, 2, 31, 5, 5, 8, 12, 1, 1, 2, 2, 18, 16, 1, 1, 6, 27, 21, 3, 7, 8, 3, 4, 1]
This autogram contains five a's, one b, two c's, two d's, thirty-one e's, five f's, five g's, eight h's, twelve i's, one j, one k, two l's, two m's, eighteen n's, sixteen o's, one p, one q, six r's, twenty-seven s's, twenty-one t's, three u's, seven v's, eight w's, three x's, four y's and one z.

EUREKA! [5, 1, 2, 2, 26, 6, 2, 4, 13, 1, 1, 1, 2, 21, 16, 1, 1, 5, 27, 20, 3, 6, 9, 5, 5, 1]
This autogram contains five a's, one b, two c's, two d's, twenty-six e's, six f's, two g's, four h's, thirteen i's, one j, one k, one l, two m's, twenty-one n's, sixteen o's, one p, one q, five r's, twenty-seven s's, twenty t's, three u's, six v's, nine w's, five x's, five y's and one z.

Finished 6273179136 iterations in 1.86 seconds which is equivalent to 3368.6 MHz.

@tuzz
Copy link
Copy Markdown
Owner

tuzz commented May 14, 2026

Hey @nkanaev, this is wonderful, thank you! More than happy to merge, and I'll give credit in the README.

I'll update the MHz for my machine (yours is faster than mine) so that it's consistent with the single-threaded case.

Thanks again.

@tuzz tuzz merged commit 24631d6 into tuzz:main May 14, 2026
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.

2 participants