Page MenuHomePhabricator

Make everything 1000x or 1000000x slower
ClosedPublic

Authored by epriestley on May 22 2015, 8:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 21, 11:39 PM
Unknown Object (File)
Mon, Apr 8, 3:29 PM
Unknown Object (File)
Sun, Mar 31, 2:02 AM
Unknown Object (File)
Thu, Mar 28, 10:01 PM
Unknown Object (File)
Mar 11 2024, 3:51 PM
Unknown Object (File)
Jan 29 2024, 12:43 AM
Unknown Object (File)
Dec 23 2023, 6:52 AM
Unknown Object (File)
Dec 15 2023, 1:39 AM
Subscribers

Details

Summary

In the great pht() conversion, some strings like "123,456" are now being printed as numbers with "%d". These come out as "123" instead of "123,456".

Use "%s" and "PhutilNumber" to present numbers with comma groupings.

Test Plan
  • Viewed DarkConsole.
  • Viewed conduit logs.
  • Viewed daemon logs.
  • Grepped for %d ms and %d us.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Make everything 1000x or 1000000x slower.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added reviewers: btrahan, joshuaspence.
joshuaspence edited edge metadata.

Would it be unreasonable to have %d always use PhutilNumber?

This revision is now accepted and ready to land.May 22 2015, 11:29 PM

Constructs like pht('T%d: %s', $task_id, $task_name) or should use integers since T1,234 isn't meaningful.

Sure, but how common is that? It could be written as pht('%s: %s', "T{$task_I'd}", $task_name) instead.

It's probably less common than it once was since we started introducing getMonogram(), but probably would need a migration pass if we were to change it.

We also don't actually parse the %d / %s stuff, and doing so might be unacceptably slow. We could statically forbid %d and then (possibly) auto-box any integers that were passed in with a PhutilNumber. This might be an improvement overall, given that getMonogram() should handle the most common use of %d and you could still force your way around it with (string)$id or whatever if you really didn't want commas.

This revision was automatically updated to reflect the committed changes.

Ah, that explains why my sandbox is so slow this morning. :P JK - feels snappy as ever. :D