0%

View on GitHub

A simple vector library written in plain C for educational purpose.

Introduction

This library is written in hope to simplify the coding process for non-professional vector computation.

This library should not be used for industrial or scientific use due to the limited precision and performance; Complex number is not supported either.

Read more »

本篇以memcpy这一函数为例, 分别在0-3的gcc优化级别下编译并反汇编, 并对反汇编得到的代码进行分析, 以观察不同优化级别下gcc的行为.

本文使用的gcc版本 7.3.0

以下汇编与反汇编均在x64平台上进行

Overview

gcc的官方文档中有对于优化参数-O的描述. 简要概括如下:

优化级别描述
0关闭优化. gcc的默认选项
1在不明显拖慢编译速度的情况下减小代码尺寸, 提升执行速度
2在不以存储空间换运行时间的前提下, 采用几乎所有gcc支持的优化方法
3二级优化的基础上进一步优化

还有便于debug的Og, 骚操作(极致优化但不遵从编码规范)的Ofast, 介于2-3级别间的Os.

整体上而言, 优化级别越高, 编译速度会越慢, 占用的内存越大; 同时, 生成的代码运行时速度越快, 可读性越低.

下面我们用实际的例子来看一看不同优化级别下gcc的具体行为. 选择memcpy作为例子是因为它的实现代码足够简单, 但是涉及了传参, 条件判断和循环, 是逻辑密集型的代码, 能很好的体现gcc在逻辑上的优化.

Read more »

The docker on Linux allows easy deployment of software. However, the idea is mainly borrowed from CD ROM.

People used to buy CD disks and put them in to the drive. Whatever brand your computer is, the content (music files, portable softwares) are always available. Such a design saves cost for two reasons:

Read more »

We liberate millions of students and teachers from exam-oriented education by reducing attention and time dissipated on training, with the solution entirely directed by mathematical models.

– Hisen Zhang

Read more »

Poets often use many words
to say a simple thing
It takes thought and time and rhyme
to make a poem sing
With music and words I’m playing
For you I have written this song
To be sure
that you know what I’m saying
I will translate as I go along


Fly me to the moon
远走高飞
and let me play among the stars
我们遨游星河
Let me see what spring is like
在遥远的星星上
on Jupiter and Mars
又有着怎样的春光
In other words
今日
Hold my hands
执子之手
In other words
只愿
Daring kiss me
与子偕老
Fill my heart with song
沉浸于音乐
and let me sing forever more
我纵声放歌
You are all I long for
只为一人
all I worship and adore
那唯一的爱慕
In other words

please be true
让这一切成真
In other words
低吟浅唱着
I love you
“我喜欢你.”