Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have fa() return a htmltools::tag() object #59

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

cpsievert
Copy link
Collaborator

Closes #58

R/fa.R Show resolved Hide resolved
R/utils.R Outdated Show resolved Hide resolved
@wch
Copy link
Collaborator

wch commented May 11, 2021

Have you tested the performance of the old vs new code? Note that the tests will also need to include rendering it to HTML text.

R/fa.R Outdated Show resolved Hide resolved
R/fa.R Outdated Show resolved Hide resolved
R/fa.R Outdated Show resolved Hide resolved
@wch
Copy link
Collaborator

wch commented May 12, 2021

Quick benchmark:

system.time({
  for (i in 1:5000) {
    as.character(fa("calendar"))
  }
})

Result before:

   user  system elapsed 
  0.493   0.023   0.515 

After:

   user  system elapsed 
  4.900   0.030   4.935 

@wch
Copy link
Collaborator

wch commented Nov 8, 2021

Following up on this PR, I think we should merge this only if we have a compelling use case in mind for the tags object over string. It's not too farfetched to imagine a document with a few hundred icons, but in that case, this change would add a non-negligible amount of time; we'd want to make sure there's a benefit that makes the cost worthwhile.

@CLAassistant
Copy link

CLAassistant commented Nov 19, 2021

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fa() should return a htmltools::tag() object
3 participants