Move wallclock() to utils

Open
#6,460 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
48/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Stale
Tech stack
c, r
Domain
tooling

Research direction

Start by comparing the wallclock() implementation in src/fread.c with its declaration in data.table.h, then inspect src/utils.c and the existing callers such as fsort() and gsumm(). Move the implementation to the utility location while keeping those callers working; confirm the package still builds and its tests pass.

Written by the indexing model from the issue text.

Description

internals
          The change looks fine, but it strikes me as odd for us to re-use `wallclock()` which is implemented in fread.c:

https://github.com/Rdatatable/data.table/blob/e73c2c849f921cf4ef51e3809842e0fee9b9f52c/src/fread.c#L379-L392

I typically think of fread.c as a separate library, since its code is also used by pydatatable. OTOH, the function is declared in data.table.h, not fread.h, and we also have calls to wallclock() in other C files, e.g. fsort() and gsumm(). So maybe it's fine.

Originally posted by @MichaelChirico in https://github.com/Rdatatable/data.table/issues/6296#issuecomment-2325650434

It's not clear if wallclock() needs to live in fread.c; it's certainly more appropriate for the implementation to be in utils.c, spiritually.

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.