This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmastrangelo@MacBook-GJG2C:/tmp/cpython | |
| Wed Apr 08 12:54:44 $ ./python.exe | |
| Python 3.13.13+ experimental free-threading build (heads/3.13:4002c3a4615, Apr 8 2026, 12:53:37) [Clang 21.0.0 (clang-2100.0.123.102)] on darwin | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> from concurrent.futures import ThreadPoolExecutor | |
| ... | |
| ... count = 0 | |
| ... with ThreadPoolExecutor(max_workers=3) as executor: | |
| ... def inc(): | |
| ... global count |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from concurrent.futures import ThreadPoolExecutor | |
| count = 0 | |
| with ThreadPoolExecutor(max_workers=3) as executor: | |
| def inc(): | |
| global count | |
| for i in range(10_000_000): | |
| count = count + 1 | |
| executor.submit(inc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * Python uses pathlib "/" operator to concatenate paths |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tasks.withType<JavaCompile> { | |
| options.setFork(true) | |
| options.forkOptions.jvmArgs = listOf("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=127.0.0.1:5009") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ๐บแตสนหหแ๊กแกแฅสพสฟหหฯณ๐ค๐ชแฃilแดัสปสผสฝjศทฦัษพษฟ๐ ๐ฑปแแง๊ษว๐ซฅลแฃ๐ฒ๐ฒโฒษฉ๐ฑแถ ๊แถ๐ฐ๐ฌแซ๐๐ฆษญแฑธแฑนแฑบ๊๊๊๊๊๐ญ๐พ๐พ๐๐ญีตีฌอฟ๐ป๐ฐ๐ฐ๐ฐฤฑำฮะIวำแถสสฮนtสสfษ๐หห๐แฃณ๐ณษช๐โฒ๐๐ฑ๐ฑ๐ฐ๊ญต๐ผจ๐๐๐ฒ๐ฒ๐ฒ๐ฒ๐จ๐๐โต๊ฒโต๐ง๊ธ๊ฝ๊น๊ผ๐พ๐คโตีแก๊ฒ๐ ๐๐น๐ โฑ๊แฃ๐พสบโฑ๐ฑง๐ฑช๐พ๊แแ๐ซ๐ซฏ๐ซฐ๐แฃด๐พ๐ลงแตปโต๐ญ๊ฃเทฆ๊ญแฑผแบแบ๐๐๐กก๐ฒ๐ฒแพ๊แ๐๐พ๐ท๐ฉหหหหษนษบrษผษฝหฎหหหฌหห๐๐๐ญ๐ฎ๐ฐ๊คท๐ญ๐ฏ๐๐ฒ ๐ฒ๐พ๐๐ข๐๐๊พ๐ต๐ถ๐ฌ๐ฑฦฦษจ๐๐ฌ๐ถ๐ฑฉ๐คฑ๐พ๐พ๐ธแถ๊ฌต๊แฃ๊๐แตผแด๐ณแ๐ท๐๐ซ๐๐โฑก๐ฑจ๐๐ฒ๐ษฌ๐า๐ฑค๐๐โฑ๐ฐแฃตโณแตฎแตณเงแตต๐ฑ๐ฑ๐ฑ๐ฃก๐นโณฦช๐ผฉ๐ฟ๊ญ๐๐๐๐๐ค๐แง๐ฐ๊แฃแฃฦญฦซแ๐๐๐๐ฅ๐ฑ๐ฒเฌฝ๐ฑฅ๐ฉ๐จ๐๐ฟ๊ซดษซโณ๐ฉ๐จแต๐ฑฃ๐พแกฐ๐๐ช๐จ๐ฉ๐ง๐ฅฃ๐ซซ๐ซฌ๐ซณ๐ซด๐ซตโฒฃ๐ฃ๐ฆเงฐเงฑ๊ขโฒ๊ฌธ๐ฑฆ๐จ๐ผโณ๐๐๐โฒศด๐ฃฃ๐ฑ๐ป๐ฝ๐บ๐ผ๐๐ชแฆแปแฝ๐ฑ๐ฑ๐ฑ๐ฑ๐ฑบ๐ฑผ๐เฅฑโฐฌ๐ฏศถ๐ฒ๐ฒแจแคแฉแแกแขแชา๐ษโฑฆอฑ๊๐ขฑโณแข๐๐ฃ๐๐ด๊ฌน๐แฃ๊กฒ๐ข๐ฝเฆฐเฆฌ๐ฑข๐ฑ๐เทญ๊แตฒ๐๐ต๐๐๐ฎแฎแพแฟ๐ฎ๐๐ฟ๊ฅ๊เฆ๐ชโฒ๐ฃ๐ะณ๐๐ขสส๐ขเฆ ีน๐ฐ๐กโฒ๐๐ ฃแแ๐ฐ แโณคเฆเฆข๐๐ฆ๐ฉ๐ช๐บ๐๐โฐ๐๐ฑแถ๐๐ป๐๊ฐโฑน๊ผ๊ ๐ฒ๐๐๐พ๐ถ๊ฌฒ๊ง๐น๐ฑ๐๐๐ญ๐ด๐ข๐บ๊๐ เฆฆแ แแพแแฎ๐ฑก๐ค๐งป๊ฃ๐ฝ๐ซแ๐๐ฆ๊ฑ๊ฌท๐ช๐จท๐๐กแดฏแแ ๊งแถ๐ ๐๐๐ฎ๐ค๐ฆ ๐ซแดคส ๐ฑ๐ฒ๐๐งนโฑ๐๐ณ๐แกฃ๊กฑแฐ สฌ๐ก๐ธ๐ผ๐พ๐ฟ๐ฝ๐๐๐จฎ๐๐ฐว๐๐ ๐ฝ๐ฑโฒ โฒงเฆงเฆฏเคเคเคเค๐ ๐ำปแฆแกแขึ๐๐โณโฐฝ๐ฐ๐ฐเคฐำท๐น๐๐ฆป๐๐ เงง๐งณ๊ง๐ถ๊ฒ๐ฅพ๐ธ๐ฅ๐๐๐นโฒฅแเฆ๐จฃ๊ญ๐ก๐ฌ๐๐๐๐๐๐ฅ๐ฏเฆฝษปแดฆ๐แดโณ๐๐๐เคฝอฐ๐๐ ๐ฮถ๐จ๐ข๐ฆ๐ญ๐ เถฏเถณโฒ๊๐ เฆทเฆจโ ๐๐ฐ๐๐ แซ๐ง๐๐เผฅ๐ญ๊ฃ๐ฃ๐ซจ๊ค๊ซ๐๐ ซ๐ฑ๐ฑ๐ฑ๐ฃ ๐พ๐ผท๐ผธ๐ผน๊ค๐ถแกแฃ๐ณ๐ด๐ถเฎฐ๐กแ๊กจ๐ฉ๐ ๐ฃ๐ผ๐ฆ๐๐จ๐ แจ๊๐ ต๐๊๐๐ฆ๐๐ด๐โฒเฒฝ๐จ๐จ๐ฎ๐แณ๐ฐ๐ิ๐๐ฅซ๐งฐ๐จ๐ขด๊ฅแ๐จเฆฎ๊คฑ๊คถฯ๊ฝ๐ฃข๊ผ๐ฃ๊ฌฝ๊ฌพ๐ซ๐เฆฃเฆน๐แฅโฒญ๊๐ค๊ช๐๐๐๊น๐ฉ๊กก๐ ๊ธ๐พฦพ๐๐๐งพ๐จ๐๐โณเคเคโฑปแด๊๐๐ฑแคแฅแฆแง๐ฒ๐ฒ๐๐โฑแดแฅ๊ซฒแแฃ๐ธ๊ค๊ฃ๐ฃปแแแจเฆ๐ซฆ๐ก๐คฒ๐ฑ๐ต๐ฆ๐ฝ๐๐แแ๐ฅ๐๐๐๐๊ฌ๊โณ๐น๐บ๐ฒ๐ฒ๐ศฅแดขแถโดญ๐แตถษโฒนส๊แฑโฐโฒ๐๐๐ฆธ๐๊ฃ๐ ญ๊๊๐๐๐๐ข๐แจแถ๊๊ญ๐๐ซง๐๐ฆพ๐ ๐๐ค๐ง๐๐ป๊ ๊๊๊๊๊๐ฅ๐๊๊๊คฐ๊คด๊คณ๊คนเฆฅ๊ค๊ฃ๊ง๊๐ฃ๊ญปโฑ๊ฉ๊๊๊ซ๐ฝส๐แถ๊ ศฟ๐ก๐เงจแด แตดเคชเคท๊น๐๐ฝ๐แถ๊ฟ๊โฐต๐ก๐๊๐แแ ๐งฑเงฏเฆเฆเงก๊ง๊ฆ๐๐๐๊เงฌ๊ญ๊ฎช๐ผณโฑ๐ แณฏแขแขแฑ๊๊ฎท๐เฆ๐ฉ๐นฯ๊ ช๊ฐ๊๊ ฉ๊ฏ๊เผกโฐฐแแฝ๐๐๐๐ ๊ฎ๐ฐ๐ฉ๐ ฐ๊ ๊๊๊ แฃ๐ฝ๐เคน๊พ๊ป๊๐๐ฅแฅ๊ท๊ฝ๊ผ๐๊๊๊๐๐ า๐งฉ๐ค๊๐ฉ๐โฒโฑถแฑ๊๊ปแฑ๐ ด๐ค๐เซง๊จฦฝแดฃแถแถ๊๐ัฏโดพ๐น๐ผ๐คฃ๐คฅ๐๐ก๐ฟ๐๊ฒ๊ฑ๐ฆงาแฅแฅ๐แฅเฎเคฌเคตเฅฟสแแแ๐๐๐ง๊๊๊ฃโณ๊ฎโฒแถ๐ฆฌแดป๐ ฑแ๊ฑ๐ฃ๊ จ๐๐ ๊ฏ๐จ๐ฅ๐กฯสแแ ตแ ถแกท๐๐ผด๊ป๊ฑ๐เงช๐ฆ๐๐ง๐ขกเชขเชฝเญฏแฅแฅ๐ฐ๐ฅฎ๊ก๊ค๊ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.carlmastrangelo; | |
| import java.util.SplittableRandom; | |
| import java.util.concurrent.ForkJoinPool; | |
| import java.util.concurrent.RecursiveAction; | |
| import java.util.concurrent.atomic.AtomicLong; | |
| public final class Queens { | |
| public static void main(String [] args) throws Exception { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Writes numbers less than 172 in one byte, numbers less than 1936 in 2 bytes. | |
| private static void writeInt(OutputStream os, int i) throws IOException { | |
| if (i < 0) { | |
| throw new UnsupportedOperationException("no neg"); | |
| } else if (i < 172) { | |
| os.write((byte) i); | |
| } else if (i < 1936) { | |
| i -= 172; | |
| os.write((byte)(172 + 42 + (i % 42))); | |
| os.write((byte)(172 + (i / 42))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Benchmark (executor) (sleepMillis) (sleeps) Mode Cnt Score Error Units | |
| SleeperBenchmark.Bench.run CACHED 1 1 ss 30 1.180 ยฑ 0.028 ms/op | |
| SleeperBenchmark.Bench.run CACHED 1 8 ss 30 1.227 ยฑ 0.044 ms/op | |
| SleeperBenchmark.Bench.run CACHED 1 64 ss 30 1.365 ยฑ 0.045 ms/op | |
| SleeperBenchmark.Bench.run CACHED 1 512 ss 30 3.764 ยฑ 0.476 ms/op | |
| SleeperBenchmark.Bench.run CACHED 1 4096 ss 30 13.375 ยฑ 0.996 ms/op | |
| SleeperBenchmark.Bench.run FIXED 1 1 ss 30 1.234 ยฑ 0.035 ms/op | |
| SleeperBenchmark.Bench.run FIXED 1 8 ss 30 1.362 ยฑ 0.084 ms/op | |
| SleeperBenchmark.Bench.run FIXED 1 64 ss 30 9.433 ยฑ 0.409 ms/op |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # From page 16 of https://ntruprime.cr.yp.to/nist/ntruprime-20201007.pdf | |
| # Linked from https://www.imperialviolet.org/2021/08/26/qrencoding.html | |
| def rebase(innums, indenoms, limit, newbase): | |
| if len(innums) != len(indenoms): | |
| raise "Bad" | |
| syms = [] | |
| if len(innums) == 1: | |
| num, denom = innums[0], indenoms[0] | |
| while denom > 1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # From https://datatracker.ietf.org/doc/html/draft-msporny-base58-03 | |
| # The description on that page is misleading or just wrong. | |
| # This was derived from converting the Rust code here: | |
| # https://github.com/hachi-bitto/btc-wallet/blob/5dde65a262d3239a23292fc2a4a692994603aeb0/wallet/src/base58.rs | |
| TABLE = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" | |
| FORWARD = {k:v for (k, v) in enumerate(TABLE)} | |
| BACK = {k:v for (v, k) in enumerate(TABLE)} |
NewerOlder