Skip to content

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

Open
cpsievert wants to merge 5 commits intorstudio:mainfrom
cpsievert:fa-tag
Open

Have fa() return a htmltools::tag() object#59
cpsievert wants to merge 5 commits intorstudio:mainfrom
cpsievert:fa-tag

Conversation

@cpsievert
Copy link
Collaborator

Closes #58

@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.

@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