Skip to content

RFC 0005: the 'a' * 100000 operation-counting worked example adds up wrong (393 should be 392) #170

Description

@uberware

Summary

RFC 0005's operation-limit section works the example "a" * 100000:

__mul__ is 1 function call + ceil(100000 / 256) = 392 string processing operations
Total: 393 operations

Both numbers are off by one: ceil(100000 / 256) is 391 (390 × 256 = 99,840, remainder
160 → one more unit), so the total is 1 + 391 = 392. The reference implementation agrees:
evaluate_with_metrics("'a' * 100000") reports operation_count == 392 (verified on
openjd-model 0.11.1, 0.11.2, and openjd-rs main at 1a89f3a).

The RULE is right and implementations follow it — only the worked example's arithmetic is
wrong. As written it invites an implementer to "match the example" and introduce an
off-by-one against every existing implementation.

(File location: rfcs/0005-expression-language.md, the "a" * 100000 example, currently
around line 1208.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions