* Painfully * slow (more than ten seconds for `(+ 1 1)`) with the language "How to Design Programs - Beginner Student"

I just installed DrRacket and tested the language "How to Design Programs - Beginner Student".

Racket - Programmable Programming Language

Racket - Getting Started

I run (+ 1 1) and it takes more than ten seconds to do this:

 Welcome to DrRacket, version 6.5 [3m]. Language: Beginning Student; memory limit: 128 MB. 2 > 

As far as I can tell, my installation is pretty much out of the box.

What interests me is if my experience is unusual,
and if there is an obvious way to troubleshoot, if so (I looked through the settings and didn't find anything obvious to configure),
or maybe the whole HTDP language was quietly abandoned or something like that ??

EDIT 1

I have these files:

 /usr/share/racket $ find -iname "*htdp*.zo" ./pkgs/htdp-lib/lang/private/compiled/create-htdp-executable_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-reader_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-beginner-abbr-reader_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-langs-save-file-prefix_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-advanced-reader_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-intermediate-lambda-reader_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-advanced_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-beginner-abbr_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-intermediate_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-intermediate-reader_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-langs_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-beginner_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-intermediate-lambda_rkt.zo ./pkgs/htdp-lib/lang/compiled/htdp-beginner-reader_rkt.zo ./pkgs/htdp-doc/scribblings/htdp-langs/compiled/htdp-langs_scrbl.zo ./pkgs/htdp-doc/scribblings/htdp-langs/compiled/htdp-ptr_scrbl.zo ./pkgs/htdp-doc/htdp/compiled/htdp_scrbl.zo ./pkgs/htdp-doc/htdp/compiled/htdp-lib_scrbl.zo ./pkgs/htdp-doc/teachpack/htdp/scribblings/compiled/htdp_scrbl.zo ./pkgs/htdp-doc/teachpack/2htdp/scribblings/compiled/2htdp_scrbl.zo 

EDIT 2 - processor and hard drive specifications

CPU

 $ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 28 model name : Intel(R) Atom(TM) CPU N450 @ 1.66GHz stepping : 10 microcode : 0x107 cpu MHz : 1000.000 cache size : 512 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 1 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts nopl aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm movbe lahf_lm dtherm bugs : bogomips : 3325.00 clflush size : 64 cache_alignment : 64 address sizes : 32 bits physical, 48 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 28 model name : Intel(R) Atom(TM) CPU N450 @ 1.66GHz stepping : 10 microcode : 0x107 cpu MHz : 1000.000 cache size : 512 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 1 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts nopl aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm movbe lahf_lm dtherm bugs : bogomips : 3325.00 clflush size : 64 cache_alignment : 64 address sizes : 32 bits physical, 48 bits virtual power management: 

HD

 $ sudo hdparm -I /dev/sda /dev/sda: ATA device, with non-removable media Model Number: Hitachi HTS545016B9A300 Serial Number: 100324PBPB06ECC0K6XL Firmware Revision: PBBOC60F Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6; Revision: ATA8-AST T13 Project D1697 Revision 0b Standards: Used: unknown (minor revision code 0x0028) Supported: 8 7 6 5 Likely used: 8 Configuration: Logical max current cylinders 16383 16383 heads 16 16 sectors/track 63 63 -- CHS current addressable sectors: 16514064 LBA user addressable sectors: 268435455 LBA48 user addressable sectors: 312581808 Logical/Physical Sector size: 512 bytes device size with M = 1024*1024: 152627 MBytes device size with M = 1000*1000: 160041 MBytes (160 GB) cache/buffer size = 7208 KBytes (type=DualPortCache) Form Factor: 2.5 inch Nominal Media Rotation Rate: 5400 Capabilities: LBA, IORDY(can be disabled) Queue depth: 32 Standby timer values: spec'd by Vendor, no device specific minimum R/W multiple sector transfer: Max = 16 Current = 16 Advanced power management level: 254 Recommended acoustic management value: 128, current value: 254 DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 Cycle time: min=120ns recommended=120ns PIO: pio0 pio1 pio2 pio3 pio4 Cycle time: no flow control=120ns IORDY flow control=120ns Commands/features: Enabled Supported: * SMART feature set Security Mode feature set * Power Management feature set * Write cache * Look-ahead * Host Protected Area feature set * WRITE_BUFFER command * READ_BUFFER command * NOP cmd * DOWNLOAD_MICROCODE * Advanced Power Management feature set Power-Up In Standby feature set * SET_FEATURES required to spinup after power up SET_MAX security extension Automatic Acoustic Management feature set * 48-bit Address feature set * Device Configuration Overlay feature set * Mandatory FLUSH_CACHE * FLUSH_CACHE_EXT * SMART error logging * SMART self-test * General Purpose Logging feature set * WRITE_{DMA|MULTIPLE}_FUA_EXT * 64-bit World wide name * IDLE_IMMEDIATE with UNLOAD * WRITE_UNCORRECTABLE_EXT command * {READ,WRITE}_DMA_EXT_GPL commands * Segmented DOWNLOAD_MICROCODE * Gen1 signaling speed (1.5Gb/s) * Gen2 signaling speed (3.0Gb/s) * Native Command Queueing (NCQ) * Host-initiated interface power management * Phy event counters * NCQ priority information Non-Zero buffer offsets in DMA Setup FIS * DMA Setup Auto-Activate optimization Device-initiated interface power management In-order data delivery * Software settings preservation * SMART Command Transport (SCT) feature set * SCT Write Same (AC2) * SCT Error Recovery Control (AC3) * SCT Features Control (AC4) * SCT Data Tables (AC5) Security: Master password revision code = 65534 supported not enabled not locked frozen not expired: security count supported: enhanced erase 64min for SECURITY ERASE UNIT. 66min for ENHANCED SECURITY ERASE UNIT. Logical Unit WWN Device Identifier: 5000cca5ffc040a7 NAA : 5 IEEE OUI : 000cca Unique ID : 5ffc040a7 Checksum: correct 

EDIT 3 command line time

ran (+ 1 1) in the novice HTDP 3 times - more than 5 seconds.

 $ time racket -t racket_HTDP_beginner.rkt 2 5.60user 1.04system 0:08.46elapsed 78%CPU (0avgtext+0avgdata 127968maxresident)k 5496inputs+0outputs (46major+40955minor)pagefaults 0swaps $ time racket -t racket_HTDP_beginner.rkt 2 5.51user 0.67system 0:06.71elapsed 92%CPU (0avgtext+0avgdata 128124maxresident)k 24inputs+0outputs (0major+41790minor)pagefaults 0swaps $ time racket -t racket_HTDP_beginner.rkt 2 5.41user 0.67system 0:06.55elapsed 92%CPU (0avgtext+0avgdata 128180maxresident)k 0inputs+0outputs (0major+36683minor)pagefaults 0swaps 

mileage (+ 1 1) in #lang racket 3 times - bit in 2 seconds.

 $ time racket -t racket_lang_racket.rkt 2 2.13user 0.25system 0:02.71elapsed 87%CPU (0avgtext+0avgdata 64996maxresident)k 0inputs+0outputs (0major+12437minor)pagefaults 0swaps $ time racket -t racket_lang_racket.rkt 2 2.15user 0.25system 0:02.63elapsed 91%CPU (0avgtext+0avgdata 61700maxresident)k 0inputs+0outputs (0major+15853minor)pagefaults 0swaps $ time racket -t racket_lang_racket.rkt 2 2.28user 0.29system 0:02.89elapsed 89%CPU (0avgtext+0avgdata 61500maxresident)k 0inputs+0outputs (0major+15015minor)pagefaults 0swaps 

EDIT 4

Run free -h every second while DrRacket is running (+ 1 1) in lang HTDP-beginner
(no other applications except DrRacket and my base system (for example, window manager, etc.) work)
(this, by the way, is a fish shell):

http://pastebin.com/2RdZAuXj

At that moment I had to kill DrRacket, because everything was freezing.

In any case, yes, it does, obviously.

Each time I re-run the code in DrRacket, the memory usage increased and remained.

I only ran it about twenty ... two-ish (?) More times
(so maybe thirty ish altogether?)
by the time he began to approach the limit and I killed him to defrost the system.

I think I should try this with the normal #lang racket and see what happens ...

EDIT 5

Yup, it flows the same way:

http://pastebin.com/373PNnY7

+6
source share
1 answer

I am 90% sure that the reason you had to wait was because your Racket installation did not complete properly.

During installation, run setup-plt . It precompiles all racket files (.rkt) into so-called zo files. If this step is omitted, then DrRacket does the compilation for you when necessary.

In your case (I guess) this is your first time using the Beginner language, so all the files related to it must be compiled. And it takes some time.

The best solution is to use the official installers from http://download.racket-lang.org/ , all of which include pre-compiled zo files.

If you used such an installer, try again - and if the problem persists, execute the file with the error message (use the error report in the Help menu in DrRacket).

+4
source

All Articles