R/shaperPerfTests.R

Defines functions perfTestGetDataSetFromDF perfTestGetInferredAndActualColumnTypes perfTestGetDataSetAndColumnTypes perfTestGetColumnTypes perfTestGetColumnTypesOld perfTestCatalogJSONDataToDFWithColumnTypes perfTestcatalogJSONDataToDF perfTestForColumnTypes

#################################################################
# IBM Confidential
# OCO Source Materials
# WDP Shaper
# (c) Copyright IBM Corp. 2017
#
# The source code for this program is not published or otherwise
# divested of its trade secrets, irrespective of what has been
# deposited with the U.S. Copyright Office.
#################################################################

perfTestForColumnTypes <- function(df) {
  library(tictoc)
  df1Col <- select(df, year)

  print("getInferredColumnTypes, 1 column")
  tic()
  getInferredColumnTypes(df1Col)
  toc()

  print("getInferredColumnTypes, all columns")
  tic()
  getInferredColumnTypes(df)
  toc()

  print("getActualColumnTypes, 1 column")
  tic()
  getActualColumnTypes(df1Col)
  toc()

  print("getActualColumnTypes, all columns")
  tic()
  getActualColumnTypes(df)
  toc()
}

perfTestcatalogJSONDataToDF <- function(df) {
  library(tictoc)
  print("catalogJSONDataToDF")
  tic()
  catalogJSONDataToDF(df)
  toc()
}

perfTestCatalogJSONDataToDFWithColumnTypes <- function(df) {
  library(tictoc)
  tic()
  ddf <- catalogJSONDataToDFWithColumnTypes(df)
  toc()
  return (ddf)
}

perfTestGetColumnTypesOld <- function(df) {
  library(tictoc)

  print("Old:")
  tic()
  ddf <- getColumnTypesOld(df)
  toc()
  ddf
}

perfTestGetColumnTypes <- function(df) {
  library(tictoc)

  print("New:")
  tic()
  ddf <- getColumnTypes(df)
  toc()
  ddf
}

perfTestGetDataSetAndColumnTypes <- function(df) {
  library(tictoc)
  tic()
  ddf <- getDataSetAndColumnTypes(df)
  toc()
}

perfTestGetInferredAndActualColumnTypes <- function(df) {
  library(tictoc)

  print("Inferred:")
  tic()
  ddf <- getInferredColumnTypes(df)
  toc()

  print("Actual:")
  tic()
  ddf <- getActualColumnTypes(df)
  toc()
}

perfTestGetDataSetFromDF <- function(df) {
  library(tictoc)

  tic()
  getDataSetFromDF(df)
  toc()
}
kevin-sorat/v2viz documentation built on Oct. 24, 2017, 8:03 a.m.