Giter VIP home page Giter VIP logo

lineprof's Introduction

lineprof

The lineprof package makes it easy to understand the performance (time and memory) of your code by using R's built-in line profiler and visualising the results in a shiny app.

lineprof is currently available only on github. You can install it with:

# install.packages("devtools")
devtools::install_github("lineprof")
devtools::install_github("shiny-slickgrid", "wch")

Note that lineprof contains a little C++ code, so you'll need a development environment.

The two most important functions are lineprof(), which does the line profiling, and shine() which displays the resulting object in an interactive shiny app:

library(lineprof)
source(find_ex("read-delim.r"))
wine <- find_ex("wine.csv")

x <- lineprof(read_delim(wine, sep = ","), torture = TRUE)
shine(x)

Visualisation

shiny app screen shot

lineprof displays five variables for each line of code:

  • t: the amount of time spent on that line (in seconds)

  • r, a: the amount of memory released and allocated (in megabytes). The assignment of memory release to a line of is not deterministic because it occurs only when gc is triggered.

  • d: the number of duplicates

You can navigate around the call stack by clicking on the link source code. Hover over individual bars to see the exact values.

Thanks

A big thanks go to Duncan Murdoch and Luke Tierney for creating the line profiling code questions and answering my many questions about how it works. Similar, I'd like to thank Joe Cheng and Winston Chang for answering all my questions about shiny.

lineprof's People

Contributors

hadley avatar cpsievert avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.