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)
Mon, Nov 25, 11:29 PM
Unknown Object (File)
Oct 27 2024, 6:26 AM
Unknown Object (File)
Oct 22 2024, 5:53 AM
Unknown Object (File)
Oct 21 2024, 10:34 PM
Unknown Object (File)
Oct 14 2024, 11:55 PM
Unknown Object (File)
Sep 17 2024, 8:18 AM
Unknown Object (File)
Sep 12 2024, 7:28 AM
Unknown Object (File)
Sep 10 2024, 12:24 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
Branch
slower
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 6219
Build 6240: [Placeholder Plan] Wait for 30 Seconds

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