Recommended Free Tools
iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Counting the reads, writes and wrapped calls a function performs at several input sizes shows how its work grows as the input gets larger. It does not show how long the function takes to run. That distinction is the core of countfn, a Python and JavaScript package that Seth Wheeler, a software engineer and graduate student, described in an article published September 27, 2026. The method answers a scaling question: if the input doubles, does the work double, grow by a factor of four, or grow more slowly than that?
What countfn measures
countfn runs a function over a ladder of input sizes and counts selected operations at each rung. It then fits those counts to a growth class. The package counts three channels:
- Reads: subscripting or iterating over the wrapped input sequence.
- Writes: assignments into the wrapped sequence.
- Calls: invocations of a callable that has been explicitly wrapped.
Calls are counted only when the author wraps a callable, so an unwrapped helper contributes nothing to the total. Comparisons are handled the same way. Wheeler notes that comparison protocol events differ between Python and JavaScript, so countfn does not try to observe them directly. Instead, the user wraps the comparator, and each comparison becomes a counted call in both languages. The three channels were chosen so that they mean the same thing in each implementation.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallHow a measurement run works
The API takes four inputs: the function under test, a list of input sizes, a builder that produces an input of a given size, and a trial count. A typical run follows this sequence:
#1 Best Overall
- 𝗘𝗳𝗳𝗼𝗿𝘁𝗹𝗲𝘀𝘀 𝗪𝗲𝗶𝗴𝗵𝗶𝗻𝗴: Supports 5 units (oz/lb:oz/fl'oz/g/mL), tare function, and includes 2 AAA batteries for hassle-free operation
- 𝗣𝗿𝗲𝗰𝗶𝘀𝗲 𝗥𝗲𝘀𝘂𝗹𝘁𝘀: Accurately weighs up to 11 lb/5 kg with 1 g increments
- 𝗦𝗶𝗺𝗽𝗹𝗲 & 𝗖𝗼𝗺𝗽𝗮𝗰𝘁: The small and sleek scale is a perfect fit for most kitchens, occupying little space and easily storable in cabinets
- 𝗘𝗮𝘀𝘆 𝘁𝗼 𝗖𝗹𝗲𝗮𝗻: Just wipe down the 304 food-grade stainless steel surfaces to keep clean
- 𝗟𝗖𝗗 𝗗𝗶𝘀𝗽𝗹𝗮𝘆: Backlit LCD screen with large fonts for easy reading
- Write a builder that returns a fresh input of size n, seeded so the run is repeatable.
- Wrap the comparator, if the function uses one, so that comparisons are counted as calls.
- Pass the function, the size ladder, the builder and the trial count to countfn.
- Read the report. For each channel it prints the count at each rung and the growth class the fit selects, or
UNDETERMINEDif it cannot choose one.
In the article’s binary-search example, the report shows reads: log n. Writes are reported as undetermined because the function performed no writes, so there was nothing to fit.
A worked example: insertion sort
Wheeler reports the same insertion-sort run in both languages with seed 17 and input size 64. The figures below come from his article and are examples he chose to show, not independently reproduced benchmarks.
Rank #2
- Digital kitchen scale with food-safe, BPA-free plastic components
- Stainless steel platform with wide LCD screen
- Weighs up to 11 pounds (2 grams minimum, up to about 5000 grams); displays results in pounds, ounces, grams, fluid ounces, and ml
- Tare button for measuring just the food, minus the container weight
- Battery operated; (2) AAA batteries included
| Measure | Reported value | Qualification |
|---|---|---|
| Reads at size 64, seed 17 | 3,812 | Identical in the Python and JavaScript implementations, per the author. |
| Writes at size 64, seed 17 | 1,848 | Identical in both implementations, per the author. |
| Comparison fit (wrapped comparator) | 0.2559 ± 0.003006 · n² | Wheeler describes this as the textbook n²/4 relation. The ± term is the author’s stated uncertainty for this fit. |
The comparison fit is a useful illustration of what the tool gives back. It states a coefficient and a growth order, not a runtime. Multiplying it out at a given n yields a count of comparisons, and nothing more.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →When the tool refuses to classify
countfn can return UNDETERMINED instead of a growth class. Wheeler presents this as deliberate. A refusal means the counts do not justify one class under the tool’s criteria. It is not a failed measurement. There are three situations that produce it.
Rank #3
- Contemporary Slim Design: Made of Stainless Steel Material; It is easy to use and clean; Provides accurate weight data with a user-friendly control panel and system; With high precision sensors to ensure correct performance and readouts
- Multiple Unit Conversion Setting: You can easily switch to any unit that you need; It can show units in the following: g / kg/lb/oz/ml/milk ml; Yes! It includes milk volume measurement
- Low Energy Consumption with Included Battery: This unit comes with batteries and doesn’t consume too much power; Plus it has an auto shut off feature
- Backlit Display (Easy to See and Read Panel): The unit has a negative white digital display so it is easy to read and see even in not well-lit rooms
- After Sales Support, and Trusted Customer Support Team assist you with any questions that might arise about your kitchen scale. We take pride in our work and want you to have a great experience from beginning to end
Exact counts with zero error
When a count depends only on input size, every rung has a standard error of zero. The fitting step therefore has no measured noise against which to judge whether two candidate classes are separated. The report then prints UNDETERMINED [exact] and still shows the full count ladder, so the numbers remain usable even though the label is withheld.
A user can declare a tolerance to force a fit. The report then has to make clear that the error bars were declared rather than measured. Declared tolerance should not be read as evidence of run-to-run noise.
Rank #4
- 【Precise Weight Food Scale】Our Food Kitchen Scale equips four high-precision load sensors, waterproof Anti-collision glass weighing panel. Large measuring capacity with 1g precise graduation from 0.1oz/3g to 33 lbs/15kg.
- 【Pratical and Durable Kitchen Scale】5 commonly used measurement units(g/kg/lb:oz/oz/ml). Screen touch and LCD display make it easy to use and read. 7.5" x 5.5" in stainless steel panel provide more stability and space for larger containers.
- 【Weight Control Scale -Easy Tare】 The Tare button allows you to subtract the weight of mug, plate, or different sized bowl, making it easy to achieve accurate readouts of nuts, grains, powder, fruit, milk and more food.
- 【Smart Design Baking Scale 】With a 2min Auto-off function, no need to worry about power consumption. Power-low alarm and overload remind. Hanging hook and 4 no-slip rubbers. Easy to clean and store.
- 【12 Months Support】We cherish every customer, your satisfaction are priority. Feel free to contact us, we will take every consultation and question seriously.
Counts that have not settled
Some algorithms need a longer ladder before their normalized counts stop moving. Wheeler’s merge-sort example shows reads divided by n log n rising from 2.755 to 2.861 across a ladder whose largest input is 32 times its smallest. The count is still drifting, so countfn reports that rather than assigning the nearest class.
Two classes that a finite ladder cannot separate
If two candidate classes both settle but remain hard to tell apart, the tool declines to break the tie. The article uses n and n log n to show the problem. Over one ladder those two curves differ by a factor of 1.3, and at the top rung of 2048 they differ by a factor of 1.8. Whether a pair of classes is separable depends on the range of sizes tested, so a longer or wider ladder can resolve a case that a short one cannot.
Best Value
- 【Precise Weight】 10kg/22lb capacity, 1g/0.1oz resolution, Great for cooking, baking, weight loss, Meal Prep, Coffee, Package, Postage.
- 【Multifunction Scale】This digital kitchen scale has 6 measurement unit: g, kg, lb, oz, ml, milk ml.
- 【Easy Tare】Remove the weight of any container to get more precise results.
- 【Portable Design】- Small Scale Dimensions:7.4 x 5.5 x 0.6 inches. The digital kitchen scale’s convenient size makes it easy to store in your kitchen.
- 【LCD Display】Big bright LCD display easy to read. The cute gram scale to turn off after 3 minutes inactivity.
Counting versus timing
Wheeler’s central claim is a division of labor. In his words: “It answers how the work grows, which is the question a timing answers badly; it does not answer how long the work takes, which is the question a timing answers well. Use both.” The table sets out where each approach is strong.
| Question | Operation counting (countfn) | Elapsed-time measurement |
|---|---|---|
| What it observes | Volume of selected operations (reads, writes, wrapped calls) | Actual wall-clock duration |
| Sensitivity to machine load | Counts are presented by the author as stable across runs | Timings vary with load and hardware, which can blur growth patterns |
| Typical blind spot | Work outside the wrapped objects is not counted; cache behavior is invisible | Can obscure how the work scales when noise is large relative to the signal |
| Question it answers well | How the work grows with input size | How long the work takes |
Two algorithms with the same read count can still differ in elapsed time because of cache behavior. When runtime or cache effects matter for the decision, Wheeler recommends measuring both.
Limits to keep in view
- The wrapper sees only what it wraps. Wheeler calls this the sharpest limit: “The instrument only sees the object it wrapped.” An out-of-place algorithm that builds and works on a separate structure can do substantial work that is never counted. The optional
probeparameter can instrument those working structures, but only if the user passes them in. - Counts are not runtime. A count tells you how much selected work occurs, not how long it takes on a given machine.
- Declared tolerances are not measurements. Where counts are exact, a tolerance has to be stated by the user and reported as such.
- A finite ladder limits separability. The n versus n log n example shows that the tested range decides whether two growth classes can be told apart.
The verification behind these examples is the author’s own. Wheeler’s article reports that the test suite caught 15 applied source mutations. No independent reproduction of the insertion-sort counts, the merge-sort drift or the package behavior has been published, so treat the figures above as the author’s results.
Installing countfn
The package is distributed for both ecosystems under the same name:
- Python:
pip install countfn - JavaScript:
npm install countfn
The article does not establish the current published version, the repository’s maintenance status or whether the package is still actively released. Check the registry page for the version you plan to use before building a workflow around it.
Quick Recap
“
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

