Free tools Windows power users keep installed
One-click scans. No signup required.
Counting operations answers a narrower question than timing does: how the selected work of a function grows as its input gets larger. The countfn approach, described by software engineer and graduate student Seth Wheeler in an article published September 27, 2026, runs a function over a ladder of input sizes, counts the operations you chose to instrument, and fits those counts to a growth pattern such as n or n log n. It does not tell you how long the function takes to run. Those are different questions, and the method is built around keeping them apart.
Two questions that timing blurs together
When people ask “how does this function’s cost scale?” they usually mean one of two things. The first is how the amount of work grows when the input doubles: does it stay linear, grow quadratically, or sit somewhere in between? The second is how many seconds the function takes on a particular machine under a particular load. Elapsed-time measurements answer the second question directly, but they answer the first one poorly, because the noise from the machine, the scheduler and the cache can hide the growth pattern you are trying to see.
As an Amazon Associate I earn from qualifying purchases.
Counting works on the first question. Each run records how many times the selected operations occurred, so the result is a set of integers that do not depend on how fast the hardware happens to be that day. The trade-off is that a count only covers what was counted. Everything else the program does is invisible to the method, a limit covered below.
The three channels that get counted
The method counts through three channels. Each one is triggered by wrapping an object, so nothing is counted that the user did not expose to the instrument.
#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
| Channel | What is counted | What triggers it |
|---|---|---|
| Reads | Subscripting and iteration over the wrapped input sequence | Indexing the input or looping over it |
| Writes | Assignments into the wrapped sequence | Assigning to an element of the input |
| Calls | Invocations of a wrapped callable | Only callables that have been explicitly wrapped |
Comparisons are not a fourth channel. Each language handles comparison through its own protocol events, so counting those events directly would mean different things in Python and JavaScript. Instead, the comparator is wrapped and every comparison becomes a counted call, which gives the same meaning in both implementations.
Running a measurement
The article describes the interface as taking four inputs: the function under test, a list of input sizes, a builder that produces an input of a given size, and a number of trials. The steps are:
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
- Install the package for your language. The article gives
pip install countfnfor Python andnpm install countfnfor JavaScript. - Write a builder that returns a wrapped input of size n, and wrap any comparator or helper callable whose calls you want to count.
- Choose a ladder of sizes that spans a useful range, and set the trial count.
- Read the output. It prints the count ladder and a growth class for each channel, or
UNDETERMINEDwhere the method declines to pick one.
For binary search, the article reports the read channel as reads: log n. Writes are reported as undetermined because binary search performs no writes, so there was nothing to fit.
Reading the author’s worked numbers
The article’s examples are the author’s own reported results. They have not been independently reproduced, so treat them as illustrations of what the output looks like rather than as benchmarks.
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
| Example | Reported figure | What it shows |
|---|---|---|
| Insertion sort, seed 17, size 64 | 3,812 reads and 1,848 writes, reported as identical in the Python and JavaScript implementations | Cross-language agreement on the shared channels, as reported by the author (Wheeler, September 27, 2026) |
| Insertion sort, comparisons with the comparator wrapped | 0.2559 ± 0.003006 · n² | The author describes this as the textbook n²/4 relation; the fitted coefficient is close to 0.25 |
| Merge sort, reads divided by n log n | Moves from 2.755 to 2.861 across a 32-times input ladder | The ratio is still drifting, so no class is assigned (Wheeler, September 27, 2026) |
| n versus n log n | 1.3 times apart over the cited ladder; 1.8 times apart at the top rung of 2048 | The two curves are only partly separable on a finite range |
When the tool refuses to choose a class
An UNDETERMINED result is part of the design, and it has three distinct causes. Knowing which one applies tells you whether to change the experiment or accept the answer.
- Exact counts. When a count depends only on input size, its standard error is zero at every rung. There is no measured noise against which to judge whether one class separates from another. The output then reads
UNDETERMINED [exact]and still prints the full count ladder. - Counts that have not settled. If the ratio of counts to a candidate class is still changing across the ladder, the method does not assign the nearest class. The merge-sort example above is this case.
- Two classes that cannot be told apart. If two candidate classes both settle but remain too close on the tested range, the method refuses to break the tie. Extending the ladder may resolve this, or it may not.
A user can declare a tolerance so that error bars exist for the fit. Those bars are then a choice the user made, not noise the method measured, and any report should say so. A refusal should not be read as a failed run. It is a statement that the observed ladder does not support one class under the estimator’s criteria.
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.
What counting cannot see
- Uninstrumented work. The author puts it plainly: “The instrument only sees the object it wrapped, which is the sharpest limit.” An out-of-place algorithm that builds a new list rather than rearranging the input can do substantial work that is never counted. The optional
probeparameter exists to instrument those working structures, but the user has to know they exist and wrap them. - Runtime and cache behaviour. Two algorithms with the same read counts can still differ in elapsed time because of memory access patterns. A count does not reveal this.
- Finite ladders. Whether two growth patterns can be told apart depends on the sizes you test, as the n versus n log n figures show.
Counts or timing: choosing for the question
| Question | Operation counting | Elapsed-time measurement |
|---|---|---|
| What it observes | Volume of the selected operations | Actual duration of the run |
| Sensitivity to machine and load noise | Presented by the author as stable across runs | Varies with the machine and its load |
| Main blind spot | Uninstrumented work and runtime effects | Growth patterns can be obscured by noise |
| Question it answers well | How the work grows | How long the work takes |
Wheeler’s own summary is the most compact statement of the division: “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.” Use counts to establish the growth class of the work you chose to count, and use timing to find out what that growth costs in practice.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Availability
The article describes countfn as a Python and JavaScript package and gives the install commands above. The article does not establish current package versions, registry status, or ongoing maintenance, so check the package registries for the release you plan to use before building on it.
Quick Recap
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.
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.




