rstudio/shiny — pull request #410 by wch (2014-02-27 22:16:47+00:00)
Title: Faster tags

This fixes #407, and is based off of jcheng5's #408 pull request. It still passes the unit tests.

Here is some speed test code and results:

```
library(shiny)
system.time({
n_choices <- 10000
choices <- paste0("choice", 1:n_choices)
names(choices) <- paste(choices, "name")
s <- selectInput("select", "Select:", multiple = TRUE, choices = choices)
format(s)
})

0.8.0:
user system elapsed
1.546 0.060 1.606

master (e234b40):
user system elapsed
5.261 0.008 5.267

Joe's faster-tags (60e355c):
user system elapsed
3.246 0.072 3.318

faster-tags-2:
user system elapsed
2.539 0.000 2.538
```

Notes:

* I also implemented this with a `textVector`, but it had no improvement in speed.
* A trailing `\n` is written to the end of the file each time `format()` is called, but it gets dropped because `readLines()` is called. (This is the same as the previous behavior, but still seems worth noting.)