Live data from Hacker News

Ask HN: Which line of code you have written will be executed the most?

news.ycombinator.com

1–10 of 21 posts

Ask HN: Which line of code you have written will be executed the most?

#1
The other day I was trying to determine which line of code I have written will get run the most?

I think for me it would be a for loop in a cron job I run on work's servers - not very exciting! I am sure HN has many more interesting examples.

maybe you have written code:

- deep in an OS that handles memory management?

- that is deeply distributed?

- that is in every JS lib? ~~cough cough left pad cough~~

- maybe it is an accidental infinite loop you once wrote?

Re: Ask HN: Which line of code you have written will be executed the most?

#2
At a fortune 100 company I consulted at, developers were rewarded for writing efficient code that was frequently reused. This was literally micro-transaction recognition and rewards a decade prior to anything resembling today's micro-transaction cloud billing.

I wrote the billing/logging system and I am certain the main "method call logger" is by far the most frequently executed code I have ever written. It was called by any method that the author wanted to be compensated for. Alas, I was not allowed to include the call to this method in the compensation pool :-(

Re: Ask HN: Which line of code you have written will be executed the most?

#6
I wrote the backend for a large saas that is in the business of pushing notifications to ios, Android, and browsers.

It's not as cool as being a frequent call at the OS level, but pretty good for an ex web developer.

I think it's very likely still in use, in some part, and surely into the billions of deliveries, so who knows how many executions of some inner loops or whatever.

Re: Ask HN: Which line of code you have written will be executed the most?

#9
On the front end it’s some code that walks the DOM in a way the standard DOM don’t. It can get DOM nodes by node type. On the backend it’s some code that walks the file system for systems automation.

Simple primitive stuff like that tends to get embedded in a variety of other automation.

Post reply on HN