Re: [Rd] locale2charset CPU overhead (PR#12633)

From: Duncan Murdoch <>
Date: Fri, 29 Aug 2008 15:52:26 -0400

On 8/28/2008 3:25 PM, wrote:
> Full_Name: R User
> Version: 2.7.2 (default binary)
> OS: Windows XP SP2
> Submission from: (NULL) (
> Hello!
> I have conducted following experiment running simple R script:
> for (i in 1:10000) {
> a<-0
> for (j in 1:1000)
> a<-c(a,j)
> }
> profiled R.dll using Intel Vtune and obtained following results!!!
> Func. Name Clocticks
> locale2charset 46,58%
> R_RunWeakRefFinalizer 20,85%
> Rf_eval 8,77%
> Rf_eval takes only about 9% of CPU time, a huge overhead on checking
> locale character set!!! It seems that is the problem with family of
> functions: c(), rbind(), cbind()

I don't have Vtune, so I don't know that its clock counts are reliable.   Could you please identify where the calls to locale2charset are coming from? I don't see anything obvious in the source that would explain this, so I suspect Vtune is misreporting.

If I were to guess, I would say your loop would be spending most of its time in memory management functions, since you allocate and reallocate "a" so many times. Since those aren't even mentioned by Vtune, I think it is confused.

Duncan Murdoch mailing list Received on Fri 29 Aug 2008 - 19:57:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 30 Aug 2008 - 07:38:15 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive