98601
98601
com
https://ebookmeta.com/product/rust-high-performance-learn-
to-skyrocket-the-performance-of-your-rust-applications-1st-
edition-iban-eguia-moraza/
OR CLICK HERE
DOWLOAD EBOOK
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any
form or by any means, without the prior written permission of the publisher, except in the case of brief
quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information
presented. However, the information contained in this book is sold without warranty, either express or implied.
Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages
caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products
mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the
accuracy of this information.
ISBN 978-1-78839-948-7
www.packtpub.com
To my father, Manu, and to the memory of my mother, Arantza, for giving me all the opportunities I had in my
life, and for being there when I most needed it.
mapt.io
Mapt is an online digital library that gives you full access to over
5,000 books and videos, as well as industry leading tools to help you
plan your personal development and advance your career. For more
information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical
eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
developers and tech professionals, just like you, to help them share
their insight with the global tech community. You can make a
general application, apply for a specific hot topic that we are
recruiting an author for, or submit your own idea.
Table of Contents
Title Page
Dedication
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
Preface
Get in touch
Reviews
Optimizations
Build configuration
Optimization level
Debug information
Link-time optimizations
Debug assertions
Panic behavior
Runtime library paths
Translation issues
Indexing degradations
Using iterators
Iterator adaptors
Real-life example
Specialized adaptors
Borrowing degradations
Cyclomatic complexity
Summary
2. Extra Performance Enhancements
Compile-time checks
Sequential state machines
Unstable sorting
Map hashing
Sequences
Maps
Sets
Summary
Allocations
Mutability, borrowing, and owning
Lifetimes
Memory representation
Alignment
Complex enumerations
Unions
Shared pointers
Summary
4. Lints and Clippy
Clippy
Installation
Configuration
Lints
Casting
Bad practice
Performance lints
Unwraps
Shadowing
Integer overflow
Lint groups
Summary
Cache misses
How can you fix it?
Cache invalidation
CPU pipeline
Branch prediction
The relevance of branch prediction for our code
Profiling tools
Valgrind
Callgrind
Cachegrind
OProfile
Summary
6. Benchmarking
Selecting what to benchmark
Benchmarking in nightly Rust
Summary
7. Built-in Macros and Configuration Items
Understanding attributes
Trait derivations
Crate features
Configuration attributes
Macros
Console printing
String formatting
Compilation environment
Loading byte arrays and strings at compile time
Code paths
Constant functions
Inline assembly and naked functions
Using bigger integers
Single instruction multiple data
Allocation API
Compiler plugins
Summary
8. Must-Have Macro Crates
10. Multithreading
Concurrency in Rust
Understanding the Send and Sync traits
The Send trait
Panicking in Rust
Moving data between threads
The move keyword
Sharing data between threads
Thread pooling
Parallel iterators
Summary
Understanding futures
Future combinators
Summary
Other Books You May Enjoy
You will learn about the great Rust community by finding great
crates that will increase the development efficiency while also
improving the performance of your application, and you will write
examples to use all your knowledge. You will write your own macros
and custom derives, and you will learn about asynchronous and
multithreaded programming.
Who this book is for
In this book, you will find everything you need to improve the
performance of your Rust code; you will learn many tricks and use
helpful crates and tools. Therefore, the book is written from the
basis that you already have some knowledge of programming in
Rust.
, Lints and Clippy, teaches you the power of lints and how to
Chapter 4
configure them to give you proper suggestions. You'll learn how to
configure clippy, an incredibly powerful tool that will point out
common errors and potential performance improvements. In this
chapter, you will learn the most important clippy lints and use them
in your development workflow.
macros to avoid code boilerplate. You will understand how the new
macros 1.1 work and create your first custom derive. Finally, you will
learn how compiler plugins internally work and will create your own
compiler plugin.
You will need a code editor or an IDE to follow the book. Rust has
been heavily tested in Microsoft's Visual Studio Code, GitHub's Atom,
and IntelliJ's IDEA IDE. I have personally used Atom to write the
code examples, but feel free to use your favorite text editor or IDE.
You will probably find plugins or extensions for your editor.
In the case of VS Code, Atom, and IntelliJ IDEA, you will find official
Rust packages along with unofficial extensions. Personally, I've been
using the Tokamak package for Atom.
Download the example code
files
You can download the example code files for this book from your
account at www.packtpub.com. If you purchased this book elsewhere, you
can visit www.packtpub.com/support and register to have the files emailed
directly to you.
Once the file is downloaded, please make sure that you unzip or
extract the folder using the latest version of:
The code bundle for the book is also hosted on GitHub at https://githu
b.com/PacktPublishing/Rust-High-Performance. In case there's an update to the
code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and
videos available at https://github.com/PacktPublishing/. Check them out!
Another Random Document on
Scribd Without Any Related Topics
one face to the other, and putting down his hand into the depths of
his great pocket, said with a smile,—
“Why, I think I shall have to read you a story which a young friend
of mine wrote, and sent to me the other day, asking my opinion of
it. I read it out of doors last evening, and have it in my pocket still.
It is funny we should begin talking about our work, for that is what
the story is about.”
Squib’s face lighted at mention of a story, as did Seppi’s also.
“Oh, please read it to us,” he said eagerly. “Has it got a name?”
“It has a motto, which perhaps will do as well; I wonder if you are
Latin scholar enough to translate it. My young friend has called it
—’Via Crucis, Via Lucis.’ Can you construe that?”
“It is something about a cross and light,” said Squib, after
considering.
“Yes; it means—’The Way of the Cross is the Way of Light.’ Now, I
will read you the story; and then perhaps you will understand
better.”
And so Herr Adler read:—
I.
Many long years ago a child dwelt in a quaint old city, and laboured
diligently to earn his daily bread. He was fatherless and motherless,
and nobody paid much heed to the lonely boy.
Now, hard by that city, just without the walls, stood a great
monastery, wherein lived men called monks, who dwelt apart from
other men, and thought best to serve God by renouncing those
things which men hold dear, and giving themselves to fasting and
prayer.
For many hundreds of years men believed that God could best be
served so; and some of the monks led very pious and godly lives.
The rich and great of the earth called them holy men, and often
gave to them great gifts in money or land, to be spent to the glory
and honour of God. And when the monks were faithful to their vows,
this money entrusted to them was spent either in relieving the
necessities of the poor, or in the erection of churches or other
buildings to be used for the honour and glory of God.
At the time of which I speak—long, long ago—when the child dwelt
in this city, a stately church was being built hard by the monastery
walls, and it fell to the lot of the boy to labour with the masons, and
to hand them the heavy hodfuls of mortar as they stood upon the
scaffolding at their toil.
Day after day they toiled at their work, and the child with them; and,
behold, the days grew very long to him, and waxed more and more
wearisome. The hodfuls of mortar seemed to become heavier day by
day; and when he saw other children passing by, laughing and
singing in their play, his heart cried out against the hardness and
dreariness of his own life. Instead of looking upwards, and taking
pleasure in the progress of the stately building, and his own humble
share in the pious work, he was looking ever earthwards, and his
heart grew heavy within him.
Now it came to pass that the monks from the monastery hard by
came ofttimes to the place where the workmen laboured, and
watched the walls of the church rising ever higher and more high,
and sometimes worked with their own hands upon some of the
beautiful carving in stone or wood with which it was to be adorned;
for to these pious men there was no drudgery in work that was done
for the honour and glory of God; and they looked forward with
longing for the day when the voice of prayer and praise should
ascend from these walls, and when men should learn ever more and
more of the nearness of His abiding presence in His church.
One of the monks who oftenest came to watch or to work was called
Father Gottlieb—and his very name seemed to show something of
the nature of the man, for Gottlieb means “the love of God;” and
those who looked upon the gentle face, which bore traces of fastings
and prayers and vigils, could see that love shone forth from his
deep-set eyes, and could hear it in the tones of his beautiful voice.
For Father Gottlieb had a voice that sometimes sounded like a
trumpet call; and since he had been dedicated to the service of the
Lord from his youth, and had been long resident within the walls of
the monastery, the men of the city had come to love and revere him,
and even the rough workmen hushed their loud voices, and were
ashamed of their idle jests, when they saw the tall form of the monk
approaching.
Sometimes as he stood and watched the work, a look of rapture
would steal into his eyes, and he would utter words which had a
beautiful sound, albeit not all of those who stood by knew what was
meant by them.
It chanced one day, as Father Gottlieb was looking on at the
builders’ toil, that he stood close beside the child of whom I have
spoken, and looking up to heaven he cried,—
“Blessed are those who are counted worthy to serve Him! Yea, thrice
blessed, for their reward shall be great!”
Then the child, looking up into the face of the monk, took courage to
ask a question.
“Of whom dost thou speak, holy father? Who are these blessed
ones?”
And the monk laid a hand upon his head as he answered,—
“All are blessed—thou and all thy fellow-labourers; for ye serve a
gracious and kindly Master, who will bless all your toil for Him.”
But the child answered and said,—
“Nay, but mine is a hard taskmaster. Day by day do I do my part,
and toil in the heat of the sun. Yet ofttimes he gives me harsh
words, and never a blessing. I am weary to death of such service.”
But the monk looked down at the child with a searching gaze and
made answer,—
“Ah, my child, thou hast not yet learned whom thou dost serve. He
is no harsh Taskmaster. He is gracious and loving, and full of
compassion and tender mercy. And blessed are those who are
permitted to toil for Him, and raise up temples to His honour and
glory!”
But the child understood him not. He thought only of his earthly
taskmaster, and in the face upturned to the monk was nothing but
thankless discontent and wonder. Father Gottlieb was gazing
upward, where high up in the dazzling blue air the builders were
toiling at the soaring spire of the church, and raising his hand and
pointing heavenwards, he asked,—
“What dost thou see there, my child?”
Then the child looked, and made answer,—
“I see the builders busy at their work.”
But the monk answered and said,—
“I see the smiling of the Master’s face.”
Then the bells began to sound forth the Angelus, and the monk
went back to the monastery, for he had his appointed work to do,
and might not linger longer. And the child took up his task again.
Night by night as the child lay upon his rude bed he thought of the
father’s words, but he comprehended them not, for his heart was full
of bitterness because of the hardness of his own lot, and the
thankless toil which he had grown to hate.
“The master is not kind,” he cried aloud. “He is a hard taskmaster.
He chides me oft. I never see a smile upon his face. I will no more
of his service. To-morrow I will go forth into the wide world, and find
fresh paths to walk in. I will no longer serve. I will be mine own
master.”
For the child thought only of an earthly master, and knew not that
he was set in the world to serve the Master in the heavens as well.
So when the day dawned he arose from his bed, while all the world
yet slumbered, and wandered away from his home.
II.
Ah, how sweet it was to stand in the early sunshine, free as the
sunbeams themselves! drinking in the pure morning air, listening to
the glad warbling of the happy birds as they flew hither and thither
in the green woodland!
Sweet, indeed, were the voices of nature, and yet the child’s soul
was not attuned to their harmonies. For each and every one of them
sang of the appointed work given to him to do in the wonderful and
mysterious realm of Nature; and the child had made a vow that he
would toil no more, that he would be no servant; so the voices of
Nature, which it was given him to understand, fell ofttimes upon
unwilling ears.
Yet, though he could understand the voices around him, he was not
surprised. It seemed as if the dewy morning had woven some spell
about him, and as if he were in some sort changed, albeit in very
truth that same child who had fled from the city, and from his
appointed place, that he might be free from service. Nor did his
heart misgive him one whit for the thing that he had done.
Climbing up a mountain he presently came upon a brook, rippling
down over the rocky boulders. Weary and footsore he sat down
beside the clear water, dipping his hot feet into a cool, deep pool,
and listening the while to the song of the laughing stream as it
leaped or glided down the side of the mountain. It sang of the rocky
cavern whence it came, fed by some unseen springs in the depths of
the hills, of the avalanches which fell with the melting of the snow
from the heights above, of the green meadows in the valley below,
towards which it was hastening, and even of great cities through
which it must pass, and where it must do an appointed work, before
it reached the great and boundless ocean towards which it, like all
water, was for ever trending.
But when the child heard this song, and saw how the water foamed
and dashed amongst the rocky boulders, instead of choosing the
softer spots for its channel, he cried aloud, and said,—
“Brooklet, wherefore dost thou choose such a toilsome way for
thyself? See yonder, where the flowers bloom and the moss makes a
soft carpet! Turn aside from those cruel rocks, and linger where all is
fresh and fair and sweet; and haste not to the haunts of men, where
there are toil and trouble! Why wilt thou not rest and play here in
this pleasant place?”
But the brooklet answered and said,—
“Thou talkest foolishly, O mortal child! Not mine the choice. I have
my appointed course and work set for me. I do but follow where the
Master points the way. Amid rocks and melting snows I gather
strength and volume for my journey; but I may not linger to disport
myself in green valleys. I have a work to do for the Master, and He it
is who bids me ever forward and onward. I am here to do His holy
will.”
But the child waxed angry, and said,—
“Hadst thou laboured as I have in the heart of the city, thou wouldst
not talk thus. Thou wouldst turn aside and do thine own pleasure.
For sweet is freedom!”
“Nay,” murmured the brooklet, “sweet is service for Him. And
blessed are they who serve the Master in His appointed way.”
Presently the child, being footsore and hungry, sought a place of
shelter for the night, and finding himself in his wanderings at the
door of a farmhouse, he craved food at the hands of the good folk
there and a night’s lodging. These, taking pity on his loneliness,
gave him bread to eat and milk to drink, and allowed him to make
his bed amidst the fragrant hay in a loft above the cowshed.
That night, waking from the sleep of exhausted nature, he thought
he heard the sound of voices beneath, and looking through a wide
crack in the floor, saw that the cattle below were conversing with
one another, nor did it surprise him, after all that had occurred to
him that day, to find that he understood what they said to each
other.
“Oh, how my bones do ache!” grumbled a young bullock, who had
been working at the plough (as is the fashion in the country in which
the child lived), “I have been yoked to the plough all day. And now I
shall have but a few short hours’ rest before they take me forth
again.”
“And we,” answered a pair of strong white oxen, who were greedily
munching their fodder, having been that night brought into their
stalls quite late, “we have been worse used than thou, brother; for
we were up with the sun, and have been working till he set,
dragging I know not how many loads of hay from the meadows to
the yard. Truly our case is an evil one! And to-morrow will be like to-
day. And after the hay comes the harvest, and nothing but work,
work, work from morning till night. Ugh! Ugh!”
“Nay, but is it not a great and blessed thing, my brothers, to share in
the beautiful harvesting of the earth?” questioned a gentle-faced
brown cow with a white star on her forehead. “Methinks it is a
gracious and goodly task to prepare the brown fields for the sowing
of the seed, and, again, to help in the joyful ingathering. For the
hearts of all men are glad with great rejoicing, and they will bless
the Master who has sent the gracious harvest blessing; and we who
have toiled and laboured will assuredly not lose our share in the
gladness and the reward.”
“Ah!” said the young bullock impatiently, “it is easy for thee and such
as thee to talk! Thou dost not labour day after day in the heat of the
sun, as I am called upon to do!”
“Nevertheless,” answered the meek cow, “I have had many a burden
to bear in my time; and I have had my moments of impatience and
murmuring. But I have learned to love my bondage now, and to
seek happiness in service; for all that we do is done for the Master,
and it is His desire that each one of His creatures shall serve Him in
the appointed place and way. Yea, and blessed is all work done for
the Master. May He accept it and bless it to the world!”
Then the elder cattle bowed their heads and said, “Amen!” but the
child started up and cried,—
“O foolish beasts, which know not the power ye possess! Rise up
and break the bonds which bind you! Rush forth free and untamed
into the wide world!”
But the cattle heeded him not, standing silent in their stalls. Only the
swallows stirred and twittered in the eaves above, and the child
presently sank to sleep again.
But, when the day broke, he rose and crept away from the farm, for
he thought, “If I stay here they will perchance seek to make a
servant of me, and I am no man’s servant now!”
Nevertheless, in this he greatly erred, for whether he willed it or no,
he was born to the service of God.
III.
For many days the child wandered on through the smiling fields
whitening for the harvest, and ever and anon as he neared some
village he would see bands of reapers going forth to their toil,
singing glad songs; or would meet them returning home at the close
of the day, weary, yet rejoicing in the glorious weather, and in the
bounteous harvest which God had given them. Many amongst them
would speak kindly to the child, and he always had food given him
when he needed it; yet he would presently slip away from those who
would have befriended him, saying in his heart,—
“These are all workers and toilers. Perchance, if I remain with them
they will ask labour of me;” for his heart was yet set against any sort
of toil, and as he went along and saw how the world toiled and
laboured, he rejoiced to think that no man could ask service of him.
Anon he came, upon one hot, sultry day, to a village. The wide
street was empty, for all the world was out in the harvest-fields, but
the great trees which bordered the road on either side gave a
grateful shade, and from the neighbourhood of an open door, half-
way down the street, came the cheerful ring of a blacksmith’s
hammer.
The child, being hot and weary, and disposed to linger in the shade,
drew nearer, and, pausing by the open door, seated himself upon an
upturned barrow and idly watched the flying sparks, and listened to
the creaking of the bellows.
Many horses were waiting to be shod, and the smith attended to
them in turn. But presently he gave a nod to his companion, who
disappeared for a while, and he himself came out wiping his heated
brow, and seated himself beside the child, in the cool shadow of the
tree.
From beneath the barrow he drew forth provision for his mid-day
meal, and, marking the weary and wistful face of the child, he gave
him food and drink in abundance, and as they dined together he
talked to him kindly.
“Whence art thou, boy?” he asked; “for I know not thy face, albeit I
have lived here, man and boy, all my life.”
“I am from a far city,” answered the child; “a city that lies beyond
yonder mountains.”
“Nay, that is far indeed!” said the smith; “and whither away now?
For thou art over-young to wander alone through the world.”
“I know not,” answered the child, and then he suddenly crimsoned,
he scarce knew why, as he felt the eyes of the smith rest gravely
upon him.
“Is it well to fly from the nest where the hand of God hath placed
us?” questioned the man with gentle severity: the child hung his
head and gave no answer.
Dinner being ended, the smith arose and girded on his leather apron
afresh; then he turned into the forge and grasped his heavy
hammer. But the child eyed him in surprise.
“It is so hot at noonday,” he said; “surely thou wilt rest awhile ere
thou dost labour again?”
The smith smiled as he swung his hammer, and blew up his forge
with the great bellows.
“Nay, child,” he answered, “rest cometh at night, and sweet it is to
the weary who have earned it by the labour of their hands in the
appointed place; but the day is given us by the Master for work, and
He looks that we fulfil our allotted tasks with the best that is in us.
Look, too, at yon patient horses, waiting to be shod, and think of the
loads of golden grain awaiting to be drawn homeward by them!
Suppose a thunder-storm comes up to-night, and the grain is not
housed because the horses be not shod, and that because the smith
was sleeping the noontide hour away when he should have been at
work. A fine story that for the Master’s ears!”
But the child looked about him round the forge, and said,—
“I had thought it all belonged to thee.”
“Ay, so it does,” answered the smith, “and was my father’s before
me.”
“Then why canst thou not rest at thy will, since no man is thy
master?”
But at that question the blacksmith turned upon him, and cried with
a loud voice,—
“Child! Though the forge be mine, and the anvil and the iron, yet my
time is not mine own, for I serve a Master to whom I must give
account of each day as it passes. Yet,” he added, in a gentler voice,
“He is full of compassion and tender mercy, and hath pity on the
weakness of His children.”
And something in the good man’s face made the child ask,—
“Dost thou find pleasure, then, in His service?”
And the blacksmith answered,—
“His smile is worth far more than ten thousand pieces of silver. Ah,
my child, thou hast still much to learn, seeing that thou knowest not
as yet thy Master.”
But the words fell on unwilling ears, and in his heart the child said,
“I have no master;” and presently, while the smith worked, he crept
away in the lengthening shadows, for he feared lest the good man
might seek to make him his fellow-labourer at the anvil.
IV.
Days and weeks rolled by, and the child still wandered on. He met
kindness from the people through whose villages he passed, and
food and shelter were given him, else must he surely have died. But
though his bodily needs were satisfied, a great hunger of the heart
arose within him that was less easily appeased, for it seemed to him
that he was quite, quite alone in the world, and that he had nothing
to do—no part or lot with the busy life he ever saw about him.
The faces of the workers were happy, but his grew pale and thin.
Men and boys sang at their toil, or called cheerily to one another,
and the women in the houses laughed as they watched the gambols
of their children, and would throw pitying glances on the toil-worn
little traveller. He was never turned away from a hospitable door
where he craved food or shelter, yet his loneliness grew ever greater
and greater, and at last his strength began to fail him, till he ofttimes
felt he could scarcely drag himself along the road. Yet he still strove
to journey on, he scarce knew why, save that he feared always, if he
remained in any place, that he would be made a servant by the good
people who befriended him.
This was why he would not stop, though almost too ill to trail himself
along, until it came to pass that one day he fell beside the road, and
lay there near unto death.
Now the place where he fell was a very lonely one, hard by a great
wood, and for a long while nobody passed that way, but anon there
came by a man, who, when he saw the child, stopped and looked
earnestly upon him, and, seeing that he was very ill, lifted him in his
arms and bore him away to his own dwelling, which was in the heart
of the great wood itself.
For many days the child lay upon the good man’s bed, and it seemed
as though the Angel of Death hovered very near to him; yet God had
mercy on the boy, and raised him up from his bed of sickness, and
the care of the kind master of the house was rewarded.
Little by little the child was able to take note of the things about
him, and to sit up in bed and see what went on; and that which
struck him most as he watched the good man of the house was, that
he was never idle. What it was that he did the child did not at first
know, for he worked outside, and all the boy could hear was the
ceaseless sound of tools, mingling often with the music of some
song or chant which the worker would croon to himself. It sounded
like carpentering work, the child thought, and as his strength
returned he began to desire to go out and watch it. So one day,
feeling stronger than he had done before, he rose and dressed
himself, and made his way out into the sunny garden, glimpses of
which he had seen all this while through the open casement of the
window.
The garden was very full of flowers, which showed signs of tender
care; and to the right was a carpenter’s shed, with all the tools and
implements, and certain articles standing about, some only just
begun, and others quite or almost finished. The master of the house
was not in the shed, but sitting in his garden, and in his hands he
held a great piece of wood, fashioned in the shape of a cross, upon
which he was carving, with wonderful skill and fidelity to nature, a
wreath of flowers, copying these from the blossoms which bloomed
around him.
When the child appeared, and timidly drew near, the good man
greeted him with a smile.
“What art thou doing?” asked the child, “and wherefore dost thou
put such strength and skill into a bit of wood? Is it not hard work to
carve it thus? And of what use is it when done?”
With another smile the worker made reply,—
“It is hard work, truly, my child, but it is blessed work too, for this
cross is to bear a message of comfort and hope to one who will
rejoice to hear it.”
But the child’s face was full of perplexity, and his eyes asked the
question which his lips knew not how to frame. The master of the
house looked searchingly at him, and then said,—
“Knowest thou not, my child, that the cross is the symbol of all the
pain or trouble or toil of this present life, which we are called upon
to bear, and to share with Him who bore the cross for us, and who
has said, ‘If any man would follow me, let him deny himself, and
take up his cross and follow me?’ And yet, because He hath borne
the cross first, He hath hallowed and sweetened it for us. So that we
who carry our crosses for love of Him, seeking to follow in His
footsteps, find them so covered with flowers that we grieve not at
their weight, but rejoice always in the fragrance of the flowers.”
The child answered nothing, and the man presently spoke again,
pointing, as he spoke, to a little wreath of smoke that curled up from
behind the trees.
“In yonder cottage lives a sick woman upon whom the Lord has laid
a heavy cross of pain and suffering. But she takes it from His hand,
and makes no murmur. This cross, covered with the forms of
beautiful flowers, I am fashioning for her.”
Day by day, as the sun sank to his rest and the master of the house,
putting aside his daily task, took out his cross and worked at the
flowers on it, the child came forth and sat beside him, watching him
and hearing him talk, and little by little it seemed to him that scales
fell from his eyes, and that some change he could not understand
was wrought within him.
When the cross was completed, he went with the maker of it to the
humble cottage where the suffering woman lay, and he watched the
light deepen in her eyes as she beheld the gift, and heard the words
which the giver spoke of it.
As they left the cottage together, he stole his hand into that of his
friend, and asked,—
“Why does she have that pain to bear? Is it not cruel of the Master
to send her such a cross?”
“Nay, child,” answered the good man; “we must not speak thus. The
Master knows best. He gives to each his own cross, and blessed is
every one who bears it after Him in meekness and lowliness of
heart.”
“Have we all a cross to bear?” asked the child. “I love not to bear
nor to suffer. Fain would I enjoy my life and be happy!”
“And so thou shalt be, even in the cross-bearing, O child, if thou wilt
walk after the Master and serve Him,” answered the master of the
house. “Hear His own words: ‘Come unto me all that be weary and
heavy laden, and I will give you rest!’ There is no rest, no earthly
happiness that can compare with that which the Master gives to
those who come to Him.”
“But how can we come to Him?” asked the child; “and how can we
bear our crosses after Him when we know not what they are, nor
where to find them?”
But at that question the good man smiled and laid his hand upon the
head of the child, drawing him between his knees as he seated
himself anew in his garden.
“We have no need to seek crosses for ourselves, my child. The
Master gives to each one of us that which He would have us carry.
Often it may be no heavier a one than the day’s toil as it comes to
us, wrought for Him with the best that is in us. All that we do can be
done for Him. He has said so—and blessed be His name! Our daily
toil is sometimes hard and cheerless of itself, but borne as the cross
after the Master, it becomes sweet and blessed to us. The cross
blossoms with flowers beneath His smile. Oh, taste and see how
gracious the Lord is. Blessed is the man that trusteth in Him!”
Tears stood in the eyes of the child as he heard these words. He laid
his hand upon that of his instructor and said,—
“Suffer me to dwell with thee and learn thy craft, and all that thou
canst teach me. I would fain take up my cross and follow the Master.
I would work with thee and for thee, and learn to serve others as
thou dost.”
But the master of the house looked long and earnestly at him, and
answered with tender gravity,—
“No man putting his hand to the plough, and looking back, is fit for
the kingdom of God.” And as the child gazed at him with wondering
and uncomprehending eyes, he added, still very gently, “It is not for
us to choose our path, nor the cross we think is lightest and
pleasantest to carry.”
Then the child’s conscience suddenly smote him, for he remembered
the hods of mortar he had left lying in the great city, beside the
unfinished church, and great tears rolled down his cheeks as he
began to understand that there, and there alone, lay the cross which
the Master had given him to bear. But although he wept bitterly, yet
his purpose did not falter. He would go back to his appointed task,
and seek the cross he had flung away in impatient despite.
So he said farewell to his friend, who gave him a blessing with tears
in his eyes, and began his weary and toilsome journey. Long and
hard did the road seem, and often his heart wellnigh failed him, but
still he pushed manfully on, for he had learned to look upwards for
help and strength. He knew who was his Master.
He met many kindnesses to cheer him on his way, and now when
food and shelter were given him, he would strive to repay his hosts
ere he started in the morning by some simple act of service—cutting
wood or carrying water, or even amusing a fretful child while the
mother prepared the morning meal. Service was no longer hard and
distasteful to him, for he strove to do all for the Master.
Many a time did some kind woman offer him service in a pleasant
homestead, and greatly would the child have rejoiced to be saved
the rest of that toilsome journey; but the memory of his forsaken
task would come afresh upon him, and he resolutely journeyed on.
“Not mine, not mine the choice,” was the cry of his heart; “I must
bear the cross the Master laid upon me!”
V.
At last, as he journeyed onwards, he saw the walls of the city rise
before him, and hastening onwards ever faster and faster, he
approached the familiar town just as the last rays of the sun were
illuminating the walls of the monastery and lighting up the beautiful
white walls of the church. But what had come to those walls all this
while? The child looked, and rubbed his eyes and looked again. For
the structure which he had left all rough and unfinished was now a
beautiful and stately building, complete in every detail, and upwards
into the blue air soared the tapering spire, crowned with its cross,
pointing ever upward towards the heaven beyond. And from within
the building came a sound of music, like to the sound of many
waters; and the child could hear the words of praise and
thanksgiving that told of the pious joy which filled the hearts of the
worshippers. And as he watched, it seemed to him that a great glory
filled the air, and that a cloud of golden light descended upon the
church, while grand, beautiful voices from within and without sang
the glorious words of promise,—
“The kingdoms of this world shall become the kingdom of our God
and of His Christ, and He shall reign for ever and ever.”
Then the child suddenly understood the end and purpose of that toil
which he had shunned—to raise a holy house of prayer and praise
that should teach men how to live and work that this glorious
kingdom might the sooner come.
Now as he stood, watching with a full heart, he felt a touch upon his
hand, and saw a hurrying throng going by, and one spoke in his ear
and said,—
“Child, haste! haste! the Master hath come and calleth thee!”
And another voice took up the word and said,—
“He calleth for all those who have helped to rear this temple to His
honour and glory.”
Then the child suddenly broke into bitter weeping, remembering
how he had rejected his share of the work, and had left his hodfuls
of mortar lying on the ground. Yet, in spite of his grief and shame,
he was borne along by the crowd, and was aware of a strange and
wonderful shining, the like of which he had never seen before; and
casting himself down with his face to the ground he confessed his
unfaithfulness, and prayed for the forgiveness of the Master.
Then it seemed to him that a hand was laid upon him, and a face
looked down at him in infinite compassion and love, and a voice said
in his heart,—
“Thy sin is forgiven thee. Arise and go in peace. Take up thy cross
and follow me.”
And in his rapture the child smote his hands together and cried
aloud,—
“O Lord, thy servant heareth!” and in so speaking he awoke.
Yes, he awoke, and behold it was all a dream! And he found himself
lying beside his hodfuls of mortar beneath the unfinished walls of
the church, while the men lay about resting from the mid-day heat,
or eating their noontide meal.
All a dream! And the child’s heart was full of joy; for he was still
here, at his post. He could take up his cross and bear it in the
Master’s strength, for the Master’s sake, and look forward in joy and
hope to that glorious day when the Kingdom should be his for ever
and ever.
And so deeply was the vision graven on his heart, that from that day
forward toil was blessed to him, and his cross blossomed with
flowers, for his work was done with all his might in the power of the
Lord, wherefore it was a joy to him and not a source of sorrow; his
heart was full of thanksgiving and praise.
Father Gottlieb noted the change in the once pale and sorrowful
face, and pausing beside the child one day, he pointed upwards and
asked,—
“What dost thou see there beyond, my child?”
And with a smile of beautiful radiance the child made answer,—
“I see the shining of the Master’s face.”
Then the good monk passed on his way rejoicing, and said in his
heart,—
“Behold His servants shall serve Him, and they shall see His face.
Hallelujah!”
The children were quite silent for several minutes after the reading
of the story. Probably both entered more into its spirit than either
could have explained. Herr Adler looked first at the one and then at
the other, and finally asked smiling,—
“Well, am I to tell my young friend the author that two little boys
have liked her story, and have learned something from it?”
“Oh yes, please,” answered Squib, drawing a long breath; and then,
after another fit of silent musing, he burst out in his sudden fashion,
—
“O Herr Adler, I will try! I will try!”
Herr Adler did not ask what it was that Squib would try to do; but
from the kind and gentle look that came into the good man’s face,
the little boy knew that he had been understood.
It was very hard to say good-bye. Squib needed all his manliness to
hold back his tears; and Seppi’s flowed freely down as their kind
friend held their hands in his for the last time, and blessed them
both, and kissed them before he took his way down the green slope.
Squib went with him a little way, but would not leave Seppi for long,
and with another rather husky good-bye, he turned just as the path
entered the pine wood, and ran back to Seppi.
He found him lying on the grass, still crying; but he soon wiped
away his tears and sat up.
“I shall see him again—somewhere. He said so himself; I am sure it
is true. I shall see him again some day. But we shall miss him so!
There is nobody else like him in the world. Oh, little Herr, I am so
glad that you have seen Herr Adler!”
And Squib answered with earnest gravity—
“And so am I; very glad!”
CHAPTER X.
A MOUNTAIN STORM.