镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Use *iB for power-of-2 bytes units consistently #7079

Open

Description

@MichaelChirico

Split off from #7074. I believe @aitap did a related fix recently (not easy to search for it). But we should try and be consistent about: 1024 bytes: kibibyte=KiB, not KB (which is 1000 bytes), and so on.

Examples found quickly:

DTPRINT(_("%8.3fs (%3.0f%%) Memory map %.3fGB file\n"), tMap-t0, 100.0*(tMap-t0)/tTot, 1.0*fileSize/(1024*1024*1024));

STOP(_("Unable to allocate %zu MB * %d thread buffers; '%d: %s'. Please read ?fwrite for nThread, buffMB and verbose options."), // # nocov

More to search through (lots of false positives since GH search is not case-sensitive, but a local grep will do better)

https://github.com/search?q=repo%3ARdatatable%2Fdata.table+%2F%5Bkmg%5Db+%2F+-path%3A%2F%5C.po%2F&type=code

Activity

  1. MichaelChirico commented on Jul 3, 2025

    @MichaelChirico
    MemberAuthor

    Two particularly problematic things:

    The use of buffMB as a parameter in fwrite():

    buffMB = 8L, nThread = getDTthreads(verbose),

    The use of mb as a parameter and output column name MB in tables():

    \item{mb}{ a function which accepts a \code{data.table} and returns its size in bytes. By default, \code{type_size} (same as \code{TRUE}) provides a fast lower bound by excluding the size of character strings in R's global cache (which may be shared) and excluding the size of list column items (which also may be shared). A column \code{"MB"} is included in the output unless \code{FALSE} or \code{NULL}. }

    I'm not sure it's worth a breaking change for renaming any of those, but something to consider. We can at least correctly describe whether they actually refer to MB or MiB (IINM it's always actually MiB).

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

    breaking-changeissues whose solution would require breaking existing behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions