Sei sulla pagina 1di 3

26/2/2017 Nubededatos:MedireltiempodeejecucindeprocesosenR

0 Ms Siguienteblog javierp_rv@hotmail.com Escritorio


EstesitioempleacookiesdeGoogleparaprestarsusservicios,parapersonalizaranunciosyparaanalizarel
trfico.Googlerecibeinformacinsobretuusodeestesitioweb.Siutilizasestesitioweb,sesobreentiendeque
aceptaselusodecookies.

Nubededatos MSINFORMACIN ENTENDIDO

Anlisisdedatos:R,Excel,Access,VBAySQL.

20140429

Buscar
MedireltiempodeejecucindeprocesosenR

proc.time
ParamedireltiempodeejecucindenuestrocdigoenRusamoslafuncinproc.time.
EstafuncindeterminaeltiemporealydelaCPU(ensegundos)desdequeelproceso
seinicienR.

t <- proc.time() # Inicia el cronmetro


# NUESTRO CODIGO
proc.time()-t # Detiene el cronmetro

Muestraenlaconsola3valores:user,system,yelapsed.

user system elapsed


0.02 0.00 0.09

UsertimeeseltiempodelaCPUdedicadoalaejecucindellasinstruccionesdel
proceso.SystemtimeeseltiempodelaCPUempleadoporelsistemaoperativo(el
ncleookernel)siguiendolasinstruccionesdelproceso(abrirficheros,iniciarotros
procesosomiraralrelojdelsistema,etc.).Elapsedtimeeseltiempotranscurrido'real'
desdequeseinicielproceso.

system.time
ParaevaluarunasolaexpresindeRusamoslafuncinsystem.time.Estafuncin
llamaalafuncinproc.time,evalalaexpresinyvuelveallamaralafuncinproc.time
devolviendoladiferenciaentreambasllamadasaproc.time.
ACERCADE

system.time(NUESTRA EXPRESIN) # Slo necesita un argumento

# Ejemplo:
system.time(for(i in 1:1e7) x <- 1)
SGUEME
Muestraenlaconsolalosmismosvaloresqueproc.time.

user system elapsed


2.59 0.01 2.60
ARCHIVO

Notas 2017(7)
2016(68)
Aproximadamenteelelapsedtimeeslasumadelosdosanteriores:usertimems
2015(128)
systemtime.Peroestonosiempreesas.Porejemplo,sidostareasde15segundosse
ejecutanenparaleloendosncleos,elusertimecomputalasumadelasdos:30 2014(125)
segundos.Mientrasqueelapsedtimenoincluyelasumadeltiempodelasdostareasen 12(13)
paralelo,soloeltiempo'real'quelaCPUtard:15segundos.Elcasocontrariosucede, 11(14)
porejemplo,siintroducimoslaexpresinSys.sleep(60)enalgnpuntodenuestro
10(14)
cdigo.DuranteesetiempolaCPUnoserutilizada,0segundos,peroelelapsedtime
computaresos60segundosysermayorquelasumadelusertimemselsystem 09(12)
time. 08(11)
07(10)
Referencias:
Nubededatos 06(10)

http://nubededatos.blogspot.com.es/2014/04/medireltiempodeejecucionde.html 1/3
26/2/2017 Nubededatos:MedireltiempodeejecucindeprocesosenR

06(10)
proc.timeysystem.time 05(10)
EstesitioempleacookiesdeGoogleparaprestarsusservicios,parapersonalizaranunciosyparaanalizarel
IDRE(UCLA)
04(10)
trfico.Googlerecibeinformacinsobretuusodeestesitioweb.Siutilizasestesitioweb,sesobreentiendeque
Significadodeproc.time
aceptaselusodecookies. Medireltiempode
Usertimemayorqueelapsedtime
ejecucindeprocesos
MSINFORMACIN ENTENDIDO
enR
PostedbyNubededatosat12:33p.m.
Abrirficherosy
Recomendar esto en Google
aplicacionesconcuadro
Labels:R,RparaPrincipiantes dedilog...
Grficoconpunto
destacadosimilara
3comentarios: GoogleAnaly...
Exportartablaoconsulta
MauricioFuentesFuentesChaves 2:37a.m. deAccesscomoCSV

MuybuenoBro,gracias Generarunnmero
aleatoriosinlafuncin
Responder ALEATOR...
Saltarlneasalimportarun
ficherodetextoenA...
MariaElenaNaranjoS 11:21p.m.
SucesindeFibonaccien
Hola.Graciasporlainformacin.ActualmenteestoytrabajandoenRenelprocesamiento R
de16millonesdedatosyaqueestoycreandounsistemaderecomendacin.Tengouna
dudayquisierasabersiestoyhaciendoalgomal.Cadavezqueintentoprocesarunagran SucesindeFibonaccien
cantidad de datos en R (p. Ej. 100mil registros y mas) me tarda mucho la corrida, para ExcelyVBA
100mil datos me tarda como una hora en hacer un simple clculo. Ser q R no es el DiagramadeParetoen
programaadecuado?.Comopodrtrabajarunvolumenaltodedatosenpocotiempo?... Excel
Teagradeceramuchosimepuedesasesorar.Unsaludo Exportartablacomo
Responder archivodetextosin
truncarl...
Respuestas
03(8)
Nubededatos 11:33p.m. 02(7)
R guarda los objetos en memoria. Sin conocer detalles sobre los datos, data 01(6)
frame o los clculos que realizas es imposible de saber. Puedes optimizar tu
cdigo,emplearprocesamientoenparaleloousarotrolenguajeoprogramapara 2013(54)
procesar previamente los datos y realizar el anlisis final en R. Te recomiendo
queplanteestupreguntaconmsdetallesenstackoverflowdondequizpuedan ETIQUETAS
ayudarte.Porotrolado,puedesexplorarestosenlacesybuscarmsinformacin
enlaweb: R Ms Excel Rstats
VBA Ms Access R para
https://stat.ethz.ch/Rmanual/Rdevel/library/base/html/Memorylimits.html Principiantes SQL Grficos
http://advr.had.co.nz/memory.html Estadstica ggplot2 Tablas
https://cran.rproject.org/web/views/HighPerformanceComputing.html dinmicas Aleatorio Distribucin
http://www.matthewckeller.com/html/memory.html normal Consulta Frmulas
Saludos, matriciales Importacin Formato
Frecuencias Fichero de texto
Responder Matemticas Base de datos Datos
externos Especificacin de
importacin/exportacin Grfico
animado Duplicados Google Drive
Introducetucomentario... WordDecimales

Comentarcomo: Unknown(Google) Salir

Vistaprevia
Publicar Avisarme

MSTER EN INTERVENCIN SOCIAL


Avalado por el CGTS

INFRMATE
Nubededatos

http://nubededatos.blogspot.com.es/2014/04/medireltiempodeejecucionde.html 2/3
26/2/2017 Nubededatos:MedireltiempodeejecucindeprocesosenR

Entradamsreciente Pginaprincipal Entradaantigua


EstesitioempleacookiesdeGoogleparaprestarsusservicios,parapersonalizaranunciosyparaanalizarel
Suscribirsea:Enviarcomentarios(Atom)
trfico.Googlerecibeinformacinsobretuusodeestesitioweb.Siutilizasestesitioweb,sesobreentiendeque
aceptaselusodecookies.

MSINFORMACIN ENTENDIDO

ConlatecnologadeBlogger.

Nubededatos

http://nubededatos.blogspot.com.es/2014/04/medireltiempodeejecucionde.html 3/3

Potrebbero piacerti anche