`
qq125922714
  • 浏览: 36496 次
社区版块
存档分类
最新评论

Toast to C

阅读更多

    <h4>By Jason – October 13, 2011</h4>
From: http://jasonvictordartmouth.posterous.com/a-toast-to-c

At
Cloudmetrx, we use a lot of C. So given the recent passing of UNIX
legend Dennis Ritchie, the creator of the C language, we think a toast
to C is only fitting.

Our extensive reliance on C is especially
unusual considering the other languages in our stack – Clojure, Node.js,
and other hipster platforms. We aren't predisposed to using older,
"venerated" technologies simply because they're older and venerated. But
when it comes to high-performant computation, there's just nothing like
C. Some will claim Java, but those people are incorrect. There's
nothing like C.

In my opinion, the reason C has maintained its
popularity for all these years is that it is relatively paradigm-free.
Most languages, for better or worse, come equipped with some inherently
recommended programming paradigm – object-oriented, functional,
whatever. The realities of the hardware, then, are sculpted to best
support that paradigm.

C, on the other hand, doesn't sculpt the
hardware. It gives you raw access to the hardware. You do what you wish
with the hardware. There is no inherent overhead due to your paradigm –
you are expected to enforce whatever paradigm you please by yourself.

C
is the Turing part of the Church-Turing Thesis. C basically gives you
math plus a ticker tape you can write onto. All algorithms revolve
around those two basic concepts: reading and writing to the tape, and
doing small mathematical operations.

As it happens, the universal
computing device referred to in the Thesis is implemented like Turing,
but often used like Church. The lambda calculus revolves around
meaningful and elegant representations of behavior, as it makes sense to
humans; but the Turing Machine represents behavior as it makes sense
for a machine based on transistors and electrons. It is the more natural
of the two; and so C is a more natural way to harness the power of the
actual hardware, at the expense of readability, and perhaps even
elegance.

It is quite a feat to create a technology still being
actively used decades after its inception and rise to popularity. I
don't think the only reason is that it is (relatively speaking)
paradigm-free. The syntax itself is also brilliant – as complex as the
language is, and as complex as managing memory is, C makes it
brilliantly clear what is going on. The C syntax has also influenced
other languages – from PERL to Java to JavaScript – a testament to its
clarity and usability.

And with all this power, C is still a joy
to write in. There's something special to me about cracking a 5-hour
energy and sitting down with <tt>vim</tt>
to hack some C. It's like
driving a manual car, and feeling the rush as you switch gears, going
faster and faster. After a month of Python, C drives like a BMW with a
rocket engine. The speed is facemelting; you run <tt>time</tt>
and your jaw drops at the results – a millisecond! For that? Amazing.

But C isn't always pretty. C can be a naughty girl that seg faults, leaving you in despair, confused, forced to use <tt>gdb</tt>
. But at the end of the day, you always come back to C – that seductress of speed. [Citation needed]

At Cloudmetrx, we use C for essentially all of our financial logic except bootstrapping
.
Without the ability to crank out a blindingly fast result in C, the
Real-Time Cloudmetrx product would likely be impossible, since we
wouldn't be able to use horizontal scale to handle the loads. And
indeed, the speed difference between a derivative pricing model – many
of which require Monte Carlo – written in C and a model written in Java
is noticeable. Not huge, but noticeable; and likely too big to serve
real-time financial analytics.

So here's to C, that naughty girl, that seductress of speed. Salud!


?

 
0
1
分享到:
评论

相关推荐

    toast:适用于IOS和Android的Toast模块

    在XCode的项目导航器中,右键单击“ Libraries ➜ Add Files to [your project's name] 转到node_modules @merryjs/toast并添加MerryToast.xcodeproj 在XCode的项目导航器中,选择您的项目。 将libMerryToast.a...

    Android-AppMsg:布局内通知。 基于Toast通知和Cyril Mottier的文章(http:android.cyrilmottier.com?p = 773)

    即使Toast-to-front应用程序与下图所示的先前显示的应用程序无关,Toast也将保留在屏幕上: 您可以很容易地注意到,Toasts的问题在于它们是持久的。 吐司被解雇后,它会显示在任何屏幕的顶部,并且在创建时所指定的...

    商务交际闪光英语口语集锦

    - _I'd ask you to raise your glass and join me in a toast to the health of all our friends present here._(请大家举杯,一起为在座的所有朋友的健康干杯。) - _Here's to you!_(为您干杯!) - _To your...

    2020_2021学年八年级英语下册Unit7FoodFestivalTopic2I'mnotsurewhetherIcanco

    为某人干杯(toast to someone):在庆祝或敬意时举杯向某人表示祝贺或敬意。 记得(不要)去做某事(remember (not) to do something):记住要或不要执行某个行动。 第一次(for the first time):首次,第一次做...

    RubyOnWheels:机器人Ruby

    RubyOnWheels Toast模块,允许您使用Ruby进行编码!..." # Prints to Toast's logger motor = Toast :: Motor . new :talon , :can , 1 # Creates a new Talon on the CAN Bus with ID 1 motor . set 0.4 # Set

    android 简单demo实现将c++代码 编译成静态库和动态库

    Toast.makeText(this, result, Toast.LENGTH_SHORT).show(); } public native String stringFromJNI(); } ``` 七、构建与运行 保存所有更改后,点击Android Studio顶部菜单的"Build" -&gt; "Rebuild Project",...

    Asteroid-Alert:这是一个使用JavaScript构建的警报库。 您可以替换传统JavaScript警报,通过库进行确认和举杯

    小行星警报 这是一个使用JavaScript构建的... $toast("Deleted", "#E74C3C"); }) $alert&#40;"Successfull", '#E74C3C'&#41; $toast("No internet connection", "#F4D03F") $loader_show("#FF5733") If you don't pr

    androidNDK helloworld

    Android NDK(Native Development Kit)是Google为Android平台提供的一套工具集,允许开发者使用C、C++等原生代码来开发应用的一部分或全部功能。这个"androidNDK helloworld"资源就是一个入门级别的示例,旨在帮助...

    安卓Android源码——不规则点击区域 三角形点击区域.zip

    例如,可以定义三个点A、B、C,然后用`moveTo(A.x, A.y)`开始,接着`lineTo(B.x, B.y)`,再`lineTo(C.x, C.y)`,最后用`close()`封闭路径。 - 调用`canvas.drawPath(path, paint)`:在`onDraw()`方法中,使用定义好...

    jni生成so并在另一个项目使用

    Toast.makeText(this, result, Toast.LENGTH_SHORT).show(); } } ``` 通过上述步骤,我们成功地在第二个项目中使用了在第一个项目中生成的JNI库。需要注意的是,如果在多个项目间共享.so库,最好将其封装为独立的...

    as生成.so文件,并引用到其它项目中进行调用

    Toast.makeText(this, result, Toast.LENGTH_SHORT).show(); } } ``` 这里通过`System.loadLibrary()`加载.so文件,并通过`native`关键字声明本地方法。 步骤五:生成.so文件 1. 在Android Studio中,点击顶部...

    JNITest.rar

    Toast.makeText(this, result, Toast.LENGTH_SHORT).show(); } public native String stringFromJNI(); } ``` 至此,我们已经完成了Java和C++之间的接口定义。接下来,需要通过CMakeLists.txt来编译C++代码。在...

    Android studio 使用NDK demo

    Toast.makeText(this, result, Toast.LENGTH_SHORT).show(); } } ``` 在`onCreate`方法中,我们调用了`stringFromJNI()`方法,并显示了返回的结果。 接下来,我们需要为C/C++代码生成JNI接口。在Android Studio...

    jni学习demo

    Toast.makeText(this, result, Toast.LENGTH_SHORT).show(); } ``` 7. **编译与运行**:更新完所有文件后,构建项目,生成APK并安装到设备上。运行应用,本地方法的实现将被执行,可以看到相应的输出。 通过...

    Android Studio NDK JNI配置Demo代码 2016

    Toast.makeText(this, result, Toast.LENGTH_SHORT).show(); } } ``` 6. **构建和运行**: 最后,确保你的Android Studio已经配置了正确的设备或模拟器,然后点击运行按钮。如果一切正常,你的应用将能够调用本地...

    2020年考研英语一真题1

    11. **潜在致癌性**:"the compound is _____ to cause cancer" 丙烯酰胺被认为可能致癌,[C] "suspected" 表示“被怀疑”,符合描述。 12. **预防原则**:"but have no hard scientific proof ____ the ...

    Android studio jni简单编程实例

    Toast.makeText(this, stringFromJNI(), Toast.LENGTH_SHORT).show(); } } ``` 5. **生成JNI头文件** 使用`javah`工具(现在通常由Android Studio的`Make Project`操作代替)生成JNI头文件。头文件会声明C/C++...

    【国开搜题】国家开放大学 一网一平台 Android核心开发技术11 期末考试押题试卷.docx

    - 选项 C 表示发送短信,这是不正确的,发送短信需要使用 `Intent.ACTION_SEND` 并且指定 `sms:` 或 `smsto:` 协议。 - 选项 D 表示其他项不正确,这是不正确的,因为 B 项是正确的。 ### 3. 移动互联网的定义 -...

    android 五子棋源码

    imageResId = new int[] { R.drawable.a, R.drawable.b, R.drawable.c, R.drawable.d, R.drawable.e }; titles = new String[imageResId.length]; titles[0] = "第一个"; titles[1] = "第二个"; titles...

    NDK_CMAKE生成so库+调用so库.rar

    Toast.makeText(this, result, Toast.LENGTH_SHORT).show(); } public native String stringFromJNI(); } ``` 总结起来,这个教程涵盖了如何使用NDK和CMake构建Android应用,将C++代码编译为.so库,并通过JNI...

Global site tag (gtag.js) - Google Analytics