Download full Mastering Python High Performance 1st Edition Fernando Doglio ebook all chapters
Download full Mastering Python High Performance 1st Edition Fernando Doglio ebook all chapters
https://ebookfinal.com/download/python-high-performance-
programming-1st-edition-gabriele-lanaro/
ebookfinal.com
https://ebookfinal.com/download/fast-python-high-performance-
techniques-for-large-datasets-meap-v10-tiago-rodrigues-antao/
ebookfinal.com
https://ebookfinal.com/download/super-high-strength-high-performance-
concrete-1st-edition-pu-xincheng-author/
ebookfinal.com
https://ebookfinal.com/download/r-high-performance-programming-1st-
edition-lim/
ebookfinal.com
PostgreSQL 9 0 High Performance Gregory Smith
https://ebookfinal.com/download/postgresql-9-0-high-performance-
gregory-smith/
ebookfinal.com
https://ebookfinal.com/download/clojure-high-performance-
programming-2nd-edition-shantanu-kumar/
ebookfinal.com
https://ebookfinal.com/download/high-performance-chelation-ion-
chromatography-1st-edition-edition-pavel-nesterenko/
ebookfinal.com
https://ebookfinal.com/download/dk-essential-managers-achieving-high-
performance-pippa-bourne/
ebookfinal.com
Mastering Python High Performance 1st Edition
Fernando Doglio Digital Instant Download
Author(s): Fernando Doglio
ISBN(s): 9781783989300, 1783989300
Edition: 1
File Details: PDF, 5.23 MB
Year: 2015
Language: english
[1]
Mastering Python High
Performance
Fernando Doglio
BIRMINGHAM - MUMBAI
Mastering Python High Performance
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, and its dealers and distributors will be held liable for any damages
caused or alleged to be 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-78398-930-0
www.packtpub.com
Credits
Reviewers Proofreader
Erik Allik Safis Editing
Mike Driscoll
Enrique Escribano Indexer
Mariammal Chettiyar
Mosudi Isiaka
Graphics
Commissioning Editor
Sheetal Aute
Kunal Parikh
Production Coordinator
Acquisition Editors
Arvindkumar Gupta
Vivek Anantharaman
Richard Brookes-Bland
Cover Work
Arvindkumar Gupta
Content Development Editors
Akashdeep Kundu
Rashmi Suvarna
Technical Editor
Vijin Boricha
Copy Editors
Relin Hedly
Karuna Narayanan
About the Author
Fernando Doglio has been working as a web developer for the past 10 years.
During that time, he shifted his focus to the Web and grabbed the opportunity of
working with most of the leading technologies, such as PHP, Ruby on Rails, MySQL,
Python, Node.js, AngularJS, AJAX, REST APIs, and so on.
In his spare time, Fernando likes to tinker and learn new things. This is why his
GitHub account keeps getting new repos every month. He's also a big open source
supporter and tries to win the support of new people with the help of his website,
lookingforpullrequests.com.
I'd like to thank my lovely wife for putting up with me and the
long hours I spent writing this book; this book would not have
been possible without her continued support. I would also like to
thank my two sons. Without them, this book would've been finished
months earlier.
Finally, I'd like to thank the reviewers and editors. They helped me get
this book in shape and achieve the quality level that you deserve.
About the Reviewers
He has worked primarily with Python, Scala, and JavaScript. Erik is currently
focusing on applying Haskell and other innovative functional programming
techniques in various industries and leveraging the power of a mathematical
approach and formalism in the wild.
Mike Driscoll has been programming in Python since 2006. He enjoys writing
about Python on his blog at http://www.blog.pythonlibrary.org/. Mike has
coauthored Core Python refcard for DZone. He recently authored Python 101 and
was a technical reviewer for the following books by Packt Publishing:
He is an expert in Java and Python and is proficient in using C/C++. Most of his
projects involve working with cloud-based technologies, such as AWS, GAE,
Hadoop, and so on. Enrique is also working on an open source research project
based on security with software-defined networking (SDN) with professor
Dong Jin at IIT Security Lab.
You can find more information about Enrique on his personal website
at enriquescribano.com. You can also reach him on LinkedIn at
linkedin.com/in/enriqueescribano.
I would like to thank my parents, Lucio and Carmen, for all the
unconditional support they have provided me with over the years.
They allowed me to be as ambitious as I wanted. Without them,
I may never have gotten to where I am today.
Lastly, I would also like to thank Paula for always being my main
inspiration and motivation since the very first day. I am so fortunate
to have her in my life.
Mosudi Isiaka is a graduate in electrical and computer engineering from the
Federal University of Technology Minna, Niger State, Nigeria. He demonstrates
excellent skills in numerous aspects of information and communication technology.
From a simple network to a mid-level complex network scenario of no less than
one thousand workstations (Microsoft Windows 7, Microsoft Windows Vista, and
Microsoft Windows XP), along with a Microsoft Windows 2008 Server R2 Active
Directory domain controller deployed in more than a single location, Mosudi has
extensive experience in implementing and managing a local area network. He has
successfully set up a data center infrastructure, VPN, WAN link optimization,
firewall and intrusion detection system, web/e-mail hosting control panel,
OpenNMS network management application, and so on.
Mosudi has the ability to use open source software and applications to achieve
enterprise-level network management solutions in scenarios that cover a virtual
private network (VPN), IP PBX, cloud computing, clustering, virtualization, routing,
high availability, customized firewall with advanced web filtering, network load
balancing, failover and link aggregation for multiple Internet access solutions, traffic
engineering, collaboration suits, network-attached storage (NAS), Linux systems
administration, virtual networking and computing.
You can find more information about him at http://www.mioemi.com. You can also
reach him at http://ng.linkedin.com/pub/isiaka-mosudi/1b/7a2/936/.
Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.com
and as a print book customer, you are entitled to a discount on the eBook copy. Get in
touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.
TM
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
[i]
Table of Contents
[ ii ]
Table of Contents
[ iii ]
Table of Contents
[ iv ]
Preface
The idea of this book came to me from the nice people at Packt Publishing.
They wanted someone who could delve into the intricacies of high performance
in Python and everything related to this subject, be it profiling, the available
tools (such as profilers and other performance enhancement techniques),
or even alternatives to the standard Python implementation.
Having said that, I welcome you to Mastering Python High Performance. In this
book, we'll cover everything related to performance improvements. Knowledge
about the subject is not strictly required (although it won't hurt), but knowledge
of the Python programming language is required, especially in some of the
Python-specific chapters.
We'll start by going through the basics of what profiling is, how it fits into the
development cycle, and the benefits related to including this practice in it. Afterwards,
we'll move on to the core tools required to get the job done (profilers and visual
profilers). Then, we will take a look at a set of optimization techniques and finally
arrive at a fully practical chapter that will provide a real-life optimization example.
Chapter 2, The Profilers, tells you how to use the core tools that will be mentioned
throughout the book.
Chapter 3, Going Visual – GUIs to Help Understand Profiler Output, covers how to
use the pyprof2calltree and RunSnakeRun tools. It also helps the developer to
understand the output of cProfile with different visualization techniques.
[v]
Preface
Chapter 4, Optimize Everything, talks about the basic process of optimization and a set
of good/recommended practices that every Python developer should follow before
considering other options.
Chapter 6, Generic Optimization Options, describes and shows you how to install and
use Cython and PyPy in order to improve code performance.
Chapter 7, Lightning Fast Number Crunching with Numba, Parakeet, and pandas, talks
about tools that help optimize Python scripts that deal with numbers. These specific
tools (Numba, Parakeet, and pandas) help make number crunching faster.
Chapter 8, Putting It All into Practice, provides a practical example of profilers, finds
its bottlenecks, and removes them using the tools and techniques mentioned in this
book. To conclude, we'll compare the results of using each technique.
• Python 2.7
• Line profiler 1.0b2
• Kcachegrind 0.7.4
• RunSnakeRun 2.0.4
• Numba 0.17
• The latest version of Parakeet
• pandas 0.15.2
The only essential requirement is to have some basic knowledge of the Python
programing language.
[ vi ]
Preface
Conventions
In this book, you will find a number of text styles that distinguish between different
kinds of information. Here are some examples of these styles and an explanation of
their meaning.
Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We
can print/gather the information we deem relevant inside the PROFILER function."
sys.setprofile(profiler)
When we wish to draw your attention to a particular part of a code block, the
relevant lines or items are set in bold:
Traceback (most recent call last):
File "cprof-test1.py", line 7, in <module>
runRe() ...
File "/usr/lib/python2.7/cProfile.py", line 140, in runctx
exec cmd in globals, locals
File "<string>", line 1, in <module>
NameError: name 're' is not defined
[ vii ]
Preface
New terms and important words are shown in bold. Words that you see on the
screen, for example, in menus or dialog boxes, appear in the text like this: "Again,
with the Callee Map selected for the first function call, we can see the entire map
of our script."
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or disliked. Reader feedback is important for us as it helps
us develop titles that you will really get the most out of.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
[ viii ]
Preface
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you could report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your
submission will be accepted and the errata will be uploaded to our website or added
to any list of existing errata under the Errata section of that title.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all
media. At Packt, we take the protection of our copyright and licenses very seriously.
If you come across any illegal copies of our works in any form on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.
We appreciate your help in protecting our authors and our ability to bring you
valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at
questions@packtpub.com, and we will do our best to address the problem.
[ ix ]
Profiling 101
Just like any infant needs to learn how to crawl before running 100 mts with
obstacles in under 12 seconds, programmers need to understand the basics of
profiling before trying to master that art. So, before we start delving into the
mysteries of performance optimization and profiling on Python programs,
we need to have a clear understanding of the basics.
Once you know the basics, you'll be able to learn about the tools and techniques.
So, to start us off, this chapter will cover everything you need to know about
profiling but were too afraid to ask. In this chapter we will do the following things:
[1]
Profiling 101
What is profiling?
A program that hasn't been optimized will normally spend most of its CPU cycles
in some particular subroutines. Profiling is the analysis of how the code behaves
in relation to the resources it's using. For instance, profiling will tell you how
much CPU time an instruction is using or how much memory the full program is
consuming. It is achieved by modifying either the source code of the program or the
binary executable form (when possible) to use something called as a profiler.
Normally, developers profile their programs when they need to either optimize their
performance or when those programs are suffering from some kind of weird bug,
which can normally be associated with memory leaks. In such cases, profiling can
help them get an in-depth understanding of how their code is using the computer's
resources (that is, how many times a certain function is being called).
A developer can use this information, along with a working knowledge of the source
code, to find the program's bottlenecks and memory leaks. The developer can then
fix whatever is wrong with the code.
There are two main methodologies for profiling software: event-based profiling and
statistical profiling. When using these types of software, you should keep in mind
that they both have pros and cons.
Event-based profiling
Not every programming language supports this type of profiling. Here are some
programming languages that support event-based profiling:
• Java: The JVMTI (JVM Tools Interface) provides hooks for profilers to trap
events such as calls, thread-related events, class loads and so on
• .NET: Just like with Java, the runtime provides events (http://
en.wikibooks.org/wiki/Introduction_to_Software_Engineering/
Testing/Profiling#Methods_of_data_gathering)
• Python: Using the sys.setprofile function, a developer can
trap events such as python_[call|return|exception] or c_
[call|return|exception]
[2]
Chapter 1
sys.setprofile(profiler)
def fib_seq(n):
seq = [ ]
if n > 0:
seq.extend(fib_seq(n-1))
seq.append(fib(n))
return seq
print fib_seq(2)
[3]
Profiling 101
[4]
Chapter 1
As you can see, PROFILER is called on every event. We can print/gather the
information we deem relevant inside the PROFILER function. The last line on the
sample code shows that the simple execution of fib_seq(2) generates a lot of
output data. If we were dealing with a real-world program, this output would be
several orders of magnitude bigger. This is why event-based profiling is normally the
last option when it comes to profiling. There are other alternatives out there (as we'll
see) that generate much less output, but, of course, have a lower accuracy rate.
Statistical profiling
Statistical profilers work by sampling the program counter at regular intervals. This
in turn allows the developer to get an idea of how much time the target program is
spending on each function. Since it works by sampling the PC, the resulting numbers
will be a statistical approximation of reality instead of exact numbers. Still, it should
be enough to get a glimpse of what the profiled program is doing and where the
bottlenecks are.
• Less data to analyze: Since we're only sampling the program's execution
instead of saving every little piece of data, the amount of information to
analyze will be significantly smaller.
• Smaller profiling footprint: Due to the way the sampling is made (using
OS interrupts), the target program suffers a smaller hit on its performance.
Although the presence of the profiler is not 100 percent unnoticed, statistical
profiling does less damage than the event-based one.
[5]
Profiling 101
"func1500","statistical_profiling.c",701,1.12%
"func1000","static_functions.c",385,0.61%
"func500","statistical_profiling.c",194,0.31%
Here is the output of profiling the same Fibonacci code from the preceding code
using a statistical profiler for Python called statprof:
% cumulative self
time seconds seconds name
100.00 0.01 0.01 B02088_01_03.py:11:fib
0.00 0.01 0.00 B02088_01_03.py:17:fib_seq
0.00 0.01 0.00 B02088_01_03.py:21:<module>
---
Sample count: 1
Total time: 0.010000 seconds
As you can see, there is quite a difference between the output of both profilers for the
same code.
Profiling is not something everyone is used to do, especially with non-critical software
(unlike peace maker embedded software or any other type of execution-critical
example). Profiling takes time and is normally useful only after we've detected that
something is wrong with our program. However, it could still be performed before
that even happens to catch possible unseen bugs, which would, in turn, help chip away
the time spent debugging the application at a later stage.
[6]
Chapter 1
However, what we sometimes fail to realize is that the higher level our languages
become (we've gone from assembler to JavaScript in just a few years), the less
we think about CPU cycles, memory allocation, CPU registries, and so on. New
generations of programmers learn their craft using higher level languages because
they're easier to understand and provide more power out of the box. However,
they also abstract the hardware and our interaction with it. As this tendency keeps
growing, the chances that new developers will even consider profiling their software
as another step on its development grows weaker by the second.
As we know, profiling measures the resources our program uses. As I've stated earlier,
they keep getting cheaper and cheaper. So, the cost of getting our software out and the
cost of making it available to a higher number of users is also getting cheaper.
These days, it is increasingly easy to create and publish an application that will be
reached by thousands of people. If they like it and spread the word through social
media, that number can blow up exponentially. Once that happens, something that is
very common is that the software will crash, or it'll become impossibly slow and the
users will just go away.
A possible explanation for the preceding scenario is, of course, a badly thought and
non-scalable architecture. After all, one single server with a limited amount of RAM
and processing power will get you so far until it becomes your bottleneck. However,
another possible explanation, one that proves to be true many times, is that we failed
to stress test our application. We didn't think about resource consumption; we just
made sure our tests passed, and we were happy with that. In other words, we failed
to go that extra mile, and as a result, our project crashed and burned.
Profiling can help avoid that crash and burn outcome, since it provides a fairly
accurate view of what our program is doing, no matter the load. So, if we profile it
with a very light load, and the result is that we're spending 80 percent of our time
doing some kind of I/O operation, it might raise a flag for us. Even if, during our
test, the application performed correctly, it might not do so under heavy stress.
Think of a memory leak-type scenario. In those cases, small tests might not generate
a big enough problem for us to detect it. However, a production deployment under
heavy stress will. Profiling can provide enough evidence for us to detect this problem
before it even turns into one.
[7]
Profiling 101
Execution time
The most basic of the numbers we can gather when profiling is the execution time.
The execution time of the entire process or just of a particular portion of the code
will shed some light on its own. If you have experience in the area your program is
running (that is, you're a web developer and you're working on a web framework),
you probably already know what it means for your system to take too much time. For
instance, a simple web server might take up to 100 milliseconds when querying the
database, rendering the response, and sending it back to the client. However, if the
same piece of code starts to slow down and now it takes 60 seconds to do the same
task, then you should start thinking about profiling. You also have to consider that
numbers here are relative. Let's assume another process: a MapReduce job that is
meant to process 2 TB of information stored on a set of text files takes 20 minutes. In
this case, you might not consider it as a slow process, even when it takes considerably
more time than the slow web server mentioned earlier.
To get this type of information, you don't really need a lot of profiling experience or
even complex tools to get the numbers. Just add the required lines into your code
and run the program.
For instance, the following code will calculate the Fibonnacci sequence for the
number 30:
import datetime
tstart = None
tend = None
def start_time():
global tstart
tstart = datetime.datetime.now()
def get_delta():
global tstart
tend = datetime.datetime.now()
return tend - tstart
def fib(n):
[8]
Chapter 1
def fib_seq(n):
seq = [ ]
if n > 0:
seq.extend(fib_seq(n-1))
seq.append(fib(n))
return seq
start_time()
print "About to calculate the fibonacci sequence for the number 30"
delta1 = get_delta()
start_time()
seq = fib_seq(30)
delta2 = get_delta()
[9]
Profiling 101
6765
10946
17711
28657
46368
75025
121393
196418
317811
514229
832040
====== Profiling results =======
Time required to print a simple message: 0:00:00.000030
Time required to calculate fibonacci: 0:00:00.642092
Time required to iterate and print the numbers: 0:00:00.000102
Based on the last three lines, we see the obvious results: the most expensive part of
the code is the actual calculation of the Fibonacci sequence.
• Heavy I/O operations, such as reading and parsing big files, executing
long-running database queries, calling external services (such as HTTP
requests), and so on
• Unexpected memory leaks that start building up until there is no memory
left for the rest of the program to execute properly
• Unoptimized code that gets executed frequently
• Intensive operations that are not cached when they could be
[ 10 ]
Chapter 1
I/O-bound code (file reads/write, database queries, and so on) is usually harder
to optimize, because that would imply changing the way the program is dealing
with that I/O (normally using core functions from the language). Instead, when
optimizing compute-bound code (like a function that is using a badly implemented
algorithm), getting a performance improvement is easier (although not necessarily
easy). This is because it just implies rewriting it.
A general indicator that you're near the end of a performance optimization process is
when most of the bottlenecks left are due to I/O-bound code.
There are some developments, such as embedded systems, that actually require
developers to pay extra attention to the amount of memory they use, because it is a
limited resource in those systems. However, an average developer can expect their
target system to have the amount of RAM they require.
With RAM and higher level languages that come with automatic memory
management (like garbage collection), the developer is less likely to pay much
attention to memory utilization, trusting the platform to do it for them.
[ 11 ]
Profiling 101
With a tool like that (the top command line tool from Linux), spotting memory leaks
can be easy, but that will depend on the type of software you're monitoring. If your
program is constantly loading data, its memory consumption rate will be different
from another program that doesn't have to deal much with external resources.
[ 12 ]
Chapter 1
For instance, if we were to chart the memory consumption over time of a program
dealing with lots of external data, it would look like the following chart:
There will be peaks, when these resources get fully loaded into memory, but there
will also be some drops, when those resources are released. Although the memory
consumption numbers fluctuate quite a bit, it's still possible to estimate the average
amount of memory that the program will use when no resources are loaded. Once
you define that area (marked as a green box in the preceding chart), you can spot
memory leaks.
Let's look at how the same chart would look with bad resource handling (not fully
releasing allocated memory):
[ 13 ]
Profiling 101
In the preceding chart, you can clearly see that not all memory is released when a
resource is no longer used, which is causing the line to move out of the green box.
This means the program is consuming more and more memory every second, even
when the resources loaded are released.
The same can be done with programs that aren't resource heavy, for instance, scripts
that execute a particular processing task for a considerable period of time. In those
cases, the memory consumption and the leaks should be easier to spot.
When the processing stage starts, the memory consumption should stabilize within a
clearly defined range. If we spot numbers outside that range, especially if it goes out
of it and never comes back, we're looking at another example of a memory leak.
[ 14 ]
Chapter 1
A very common pitfall developers face while starting to code a new piece of software
is premature optimization.
When this happens, the end result ends up being quite the opposite of the intended
optimized code. It can contain an incomplete version of the required solution, or it
can even contain errors derived from the optimization-driven design decisions.
As a normal rule of thumb, if you haven't measured (profiled) your code, optimizing
it might not be the best idea. First, focus on readable code. Then, profile it and find out
where the real bottlenecks are, and as a final step, perform the actual optimization.
RTC helps quantify the execution time of a given algorithm. It does so by providing
a mathematical approximation of the time a piece of code will take to execute for any
given input. It is an approximation, because that way, we're able to group similar
algorithms using that value.
In other words, this notation will give us a broad idea of how long our algorithm
will take to process an arbitrarily large input. It will not, however, give us a precise
number for the time of execution, which would require a more in-depth analysis of
the source code.
As I've said earlier, we can use this tendency to group algorithms. Here are some of
the most common groups:
[ 15 ]
Profiling 101
Here are some examples of code that have O(1) execution time:
Even something more conceptually complex, like finding the value of a key inside
a dictionary (or hash table), if implemented correctly, can be done in constant time.
Technically speaking, accessing an element on the hash takes O(1) amortized time,
which roughly means that the average time each operation takes (without taking into
account edge cases) is a constant O(1) time.
[ 16 ]
Chapter 1
The preceding chart clearly shows that both the blue (3n) line and the red one
(4n + 5) have the same upper limit as the black line (n) when x tends to infinity.
So, to simplify, we can just say that all three functions are O(n).
The preceding chart shows three different logarithmic functions. You can clearly
see that they all possess a similar shape, including the upper limit x, which keeps
increasing to infinity.
• Binary search
• Calculating Fibonacci numbers (using matrix multiplications)
[ 17 ]
Profiling 101
Here are some examples of algorithms that have this order of execution:
• Merge sort
• Heap sort
• Quick sort (at least its average time complexity)
Let's see a few examples of plotted linearithmic functions to understand them better:
[ 18 ]
Chapter 1
Here is a rough approximation of how the execution time of our algorithm would
look with factorial time:
• Bubble sort
• Traversing a 2D array
• Insertion sort
[ 19 ]
Exploring the Variety of Random
Documents with Different Content
It was on the 1st of October, a month in which the weather is
more severe in that climate than is January in Paris, that he
appeared before Narva. The Czar, who in such weather would often
ride 400 leagues to see a mine or a canal, spared his men no more
than himself. Besides, he knew that the Swedes, ever since the time
of Gustavus Adolphus, fought in the depth of winter as well as in
summer, and he wanted to accustom his Russians not to care about
the seasons, so that some day they might at least equal the Swedes.
So at a time when frost and snow force nations in temperate
climates to suspend hostilities Peter was besieging Narva, thirty
degrees from the Pole, and Charles was advancing to its relief. The
Czar had no sooner arrived before the place than he hastened to put
into practice all that he had lately learned on his travels: he drew out
his camp, fortified it on all sides, built walls at intervals, and opened
the trench with his own hands. He had given the command of the
army to the Duke of Croy, a German, and a clever general, who got
little support from the Russian officers.
The Czar himself had only the ordinary rank of lieutenant in his
own army. He thought it necessary to give an example of military
obedience to his nobility, who up till then had been undisciplined and
accustomed to lead bands of ill-armed slaves without experience or
order. There is nothing surprising in the fact that he who at
Amsterdam turned carpenter to procure fleets for himself should at
Narva turn lieutenant in order to teach his people the art of war.
The Russians are strong and indefatigable, and perhaps as brave
as the Swedes, but it requires time to make veterans, and discipline
to make them invincible. The only fairly reliable regiments were
commanded by German officers, but there were very few of them;
the rest were savages torn from their forests, clothed in the skins of
wild beasts, some armed with arrows and others with clubs. Few had
muskets, none had seen a regular siege, there was not one good
gunner in the whole army.
A hundred and fifty cannon, which ought to have reduced the little
town of Narva to ashes, hardly made a breach, while every moment
the artillery of the town were destroying whole lines at work in the
trenches. Narva was practically unfortified, and Count Horn, who
was in command, had not a thousand regular troops, and yet this
immense army was not able to reduce it in ten weeks.
On the 15th of November the Czar heard that the King of Sweden
had crossed the sea with 200 transports and was on his way to the
relief of Narva. There were not more than 20,000 Swedes, but
superiority of numbers was the Czar’s only advantage. He was far,
therefore, from despising his enemy, and used all his skill to crush
him; and not content with 100,000 men he levied another army to
oppose him and harass him in his advance. He had already sent for
30,000 men who were advancing from Plescow by forced marches.
He then took a step which would render him contemptible if so great
a legislator could be so. He left his camp, where his presence was
necessary, to go to meet these reinforcements, which could quite
well reach the camp without his aid; this step made it appear that he
was afraid of fighting, in an entrenched camp, a young and
inexperienced prince, who might attack him.
However that may be, his plan was to hem in the King between
two armies. Nor was this all: a detachment of 30,000 men from the
camp before Narva was posted at a league’s distance from the town,
on the King of Sweden’s route, 20,000 Strelitz were further off on the
same route, and 5,000 others formed an advanced guard. Charles
would have to force his way through all these troops before he could
reach the camp, which was fortified by a rampart and a double ditch.
The King of Sweden had landed at Pernaw, on the Gulf of Riga, with
about 15,000 foot and more than 4,000 horse. From Pernaw he
made a forced march to Revel, followed by all his horse and only
4,000 of his foot. He continually advanced without waiting for the rest
of his troops.
Soon he found himself, with only 8,000 men, in presence of the
enemy’s outposts. He did not hesitate to attack them one after the
other, without giving them time to find out with how small a number
they had to contend. The Russians, when they saw the Swedes
advancing against them, took it for granted that they had a whole
army to encounter, and the advanced guard of 5,000 men, who were
holding a pass between the hills where 100 men of courage might
have barred the passage of a whole army, fled at the first approach
of the Swedes. The 20,000 men behind them, terrified at the flight of
their countrymen, were overcome by fear and caused panic in the
camp to which they fled. All the posts were carried in three days and
a half, and what would have been on other occasions reckoned three
distinct victories did not delay the King an hour. At last he appeared
with his 8,000 men, wearied with the fatigues of so long a march,
before a camp of 80,000 Russians, protected by 150 cannon. He
hardly allowed them time for rest before he gave orders for an
instant attack.
The signal was two musket-shots, and the word in German, “With
God’s help.” A general officer pointed out to him the greatness of the
danger. “Surely you have no doubt,” he replied, “but that I with my
8,000 brave Swedes shall trample down 80,000 Russians!” Then a
moment after, fearing that his speech was boastful, he ran after the
officer. “Do you not agree with me,” he said, “that I have a double
advantage over the enemy? First because their horse will be useless
to them, and secondly because, as the position is cramped, their
numbers will only incommode them, so that I shall really possess the
advantage.” The officer thought it best not to differ from him, and so
they attacked the Russians about noon, on the 30th November.
As soon as the cannon of the Swedes had made a breach in the
entrenchments they advanced with fixed bayonets, having the snow,
which drove full in the face of the enemy, behind them. The Russians
stood the fire for half-an-hour without quitting their posts. The King
attacked the Czar’s quarters, on the other side of the camp, and
hoped to meet him in person, for he was ignorant of the fact that he
had gone to meet his 40,000 reinforcements who were expected
shortly. At the first discharge the King received a ball in the shoulder;
but it was a spent ball which rested in the folds of his black cravat
and did him no harm.
His horse was killed under him, and it is said that the King leapt
nimbly on another, exclaiming, “These fellows make me take
exercise.” Then he continued to advance and give orders with the
same presence of mind as before. Within three hours the
entrenchments were carried on all sides: the King chased the
enemy’s right as far as the river Narva with his left, if one may speak
of “chasing” when 4,000 men are in pursuit of nearly 50,000. The
bridge broke under them as they fled; in a moment the river was full
of dead bodies; the rest in despair returned to their camp without
knowing the direction in which they were going. They found some
huts behind which they stationed themselves; there they defended
themselves for a time because they had no mean of escape; but
finally their generals, Dolgorouky, Gollofkin and Federowitz
surrendered to the King and laid down their arms at his feet. Just
then the Duke of Croy arrived to surrender with thirty officers.
Charles received all these prisoners with as charming and
engaging a manner as if he were feting them in his own Court. He
only put the general officers under a guard; all the under officers and
soldiers were disarmed and taken to the river Narva, where they
were provided with boats to convey them to their own country. In the
meantime night came on, and the right wing of the Russian force
was still fighting. The Swedes had not lost 1,500 men; 18,000
Russians had been killed in their entrenchments, many had been
drowned, many had crossed the river; but still there remained
enough to entirely exterminate the Swedes. But it is not the number
lost, but the panic of survivors which spells defeat in war. The King
made haste to seize the enemy’s artillery before nightfall. He took up
an advantageous position between their camp and the town, and
there got some hours’ sleep on the ground, wrapped in his cloak,
waiting till at daybreak he could fall on the enemy’s left wing, which
was not yet completely routed.
At two o’clock in the morning General Wade, who was in
command of that wing, having heard of the King’s gracious reception
of the other generals and his sending home of the subalterns and
soldiers, asked the same favour of him. The conqueror sent him
word that he need only approach at the head of his troops and
surrender his arms and standards. Soon the general appeared with
his Russians, to the number of about 30,000. Soldiers and officers
marched bare-headed in front of less than 7,000 Swedes. As the
soldiers passed before him they threw down their muskets and
swords; the officers surrendered their ensigns and colours.
He let the whole band cross the river without keeping one single
prisoner. Had he put them under guard the number of prisoners
would have been at least five times that of the conquerors.
He then victoriously entered Narva, attended by the Duke of Croy
and the other Russian officers; he ordered their swords to be
restored to them, and when he heard that they wanted money,
because the tradesmen of Narva refused to trust them, he sent the
Duke of Croy 1,000 ducats, and 500 to every Russian officer, who
were full of admiration for this treatment, which they had never
conceived possible. An account of the victory was at once drawn up
to send to Stockholm, and to the allies, but the King erased with his
own hands whatever redounded too much to his own credit or to the
discredit of the Czar. His modesty could not hinder them from striking
several medals to commemorate the event at Stockholm. One of
these represented him, on one face, standing on a pedestal, to
which a Russian, Dane and Pole were chained; and on the reverse a
Hercules, armed with a club, trampling a Cerberus, and the
inscription, “Tres uno contudit ictu.”
Among the prisoners made on the day of the battle of Narva was
one who was typical of the revolutions of fortune. He was the eldest
son and heir of the King of Georgia. He was called the “Czarafis,” a
name which means son of the Czar among all the Tartars as well as
in Russia; for the word Czar meant King among the ancient
Scythians, from whom all these peoples are descended, and is not
derived from the name of the Cæsars, so long unknown to these
barbarians. His father, Mitelleski, who was master of the most
beautiful part of the country between the mountains of Ararat and the
eastern extremity of the Black Sea, had been driven from his
kingdom by his own subjects in 1688, and preferred throwing himself
on the mercy of the Emperor of Russia, to applying to the Turks. This
king’s son, at the age of nineteen, helped Peter the Great in his
expedition against the Swedes, and was taken in battle by some
Finnish soldiers, who had already stripped him, and were on the
point of killing him, when Count Renschild rescued him from their
hands, supplied him with clothes, and presented him to his master.
Charles sent him to Stockholm, where the wretched prince died
shortly after. When he took leave, the King made aloud a natural
reflection on the strangeness of the fate of an Asiatic prince, born at
the foot of the Caucasus, and going to live a prisoner among the
snows of Sweden:
“It is just,” he said, “as if I were to be one day prisoner among the
Tartars of the Crimea.” At that time these words made no impression,
but afterwards, when the prediction had been justified in the event,
there was but too much reason to remember them.
The Czar was advancing by long marches with a force of 40,000
Russians, expecting to surround his enemy on all sides. When he
had got half-way he heard of the battle of Narva, and the dispersal of
his whole camp. He thought it best not to attack a victor who had
shortly before destroyed 100,000 entrenched troops, with a force of
40,000 raw and undisciplined men. He retraced his steps, hoping to
discipline his troops at the same time as civilize his subjects. “I
know,” he remarked, “that the Swedes will long beat us, but in time
they will teach us to beat them.” Moscow, his capital, was terror-
stricken to hear of this defeat. So great was the pride and ignorance
of the people that they were convinced they had been conquered by
superhuman agency, and that the Swedes had secured their victory
by magic. This opinion was so widespread that a public prayer to
Saint Nicholas, patron saint of Russia, was ordered. This prayer is
too singular to be omitted. It runs thus—
“O thou, our perpetual consolation in all our adversities, great
Saint Nicholas, of infinite power, how have we offended thee in our
sacrifices, our genuflections, our bowings, our thanksgivings, that
thou hast thus forsaken us? We have implored thine assistance
against these terrible, insolent, savage, dreadful, invincible
destroyers, when, like lions and bears who have lost their young,
they have fallen upon us, terrified us, wounded us, slain us by
thousands, who are thy people. As it is impossible that this should
have happened without sorcery and witchcraft, we beseech thee, O
great Nicholas, to be our champion and standard-bearer, to deliver
us from this band of sorcerers, and to drive them from our coasts
with the reward they deserve.”
While the Russians were thus complaining of their defeat to St.
Nicholas, Charles XII returned thanks to God, and prepared himself
for fresh victories.
The King of Poland fully expected that his enemy, who had
conquered the Danes and Russians, would next turn his arms
against him. He made a firmer alliance with the Czar, and the two
princes arranged an interview at which they could agree on some
policy. They met at Brizen, a small town in Lithuania, without any of
the formalities which only delay business, and for which they were in
no humour under the circumstances. The princes of the North met
with a familiarity which is not yet the fashion in the south of Europe.
Peter and Augustus passed fifteen days together in pleasures which
passed all bounds; for the Czar, who had set himself to reform his
kingdom, could not restrain his own dangerous inclination to riotous
living.
The King of Poland promised to furnish the Czar with 50,000
German troops, which were to be hired from several princes, and
which the Czar was to pay. He, on the other hand, was to send
50,000 Russians to Poland to be trained in the art of war, and was
also to pay the King of Poland 3,000,000 rixdollars within two years.
Had this treaty been carried out it might have been fatal to the King
of Sweden. It was a ready and sure way of making good soldiers of
the Russians, and might perhaps have forged irons for half Europe.
Charles XII set himself to prevent the King of Poland from getting
the benefit of this treaty. After passing the winter in Narva, he
marched into Livonia, to the very town of Riga which King Augustus
had failed to take. The Saxon troops were posted along the river
Dwina, which is very broad at this spot, and their task was to dispute
the passage with Charles, who lay on the other bank. The Saxons
were not then commanded by their Prince, who was at that time ill;
but their leader was Marshal Stenau, who was general; under him
commanded Prince Ferdinand, Duke of Courland, and the same
Patkul, who, after having maintained his rights on paper, defended
his country against Charles sword in hand at the peril of his life.
The King of Sweden had great boats made, after a new model,
so that the sides were far higher than ordinary, and could be let
down and drawn up like a drawbridge. When raised they protected
the troops they carried, and when let down they formed a bridge to
land by.
He also employed another artifice. Having noticed that the wind
blew straight from the north, where his troops lay, to the south,
where his enemies were encamped, he fired a large heap of wet
straw, which spread a thick smoke over the river and prevented the
Saxons from seeing his troops, or guessing at his actions. Under
cover of this cloud he sent out boats filled with smoking straw, so
that the cloud increased, and being right in the enemy’s face,
prevented them from knowing whether the King had started on the
passage or not. Meanwhile, he himself led the execution of his
scheme; and when he was in the middle of the river, “Well,” he said,
“the Dwina is going to be as kind to us as the sea of Copenhagen;
take my word for it, General, we shall beat them.” He got to the other
side in a quarter of an hour, and was vexed to see three people leap
to shore before him. He had his cannon landed at once, and drew up
his line without any opposition from the enemy, who were blinded by
the smoke. When the wind dispersed the smoke the Saxons saw the
King of Sweden already on his march against them. Marshal Stenau
lost not a moment, but at the first appearance of the Swedes fell
furiously upon them with the best part of his horse. The violent shock
coming upon the Swedes just as they were forming, threw them into
disorder. They gave way, were broken, and pursued up to the river.
The King of Sweden rallied them instantly in the midst of the stream,
with as much ease as if he were holding a review. Then his troops,
marching in closer formation than before, beat back Marshal Stenau,
and advanced into the plain. Stenau felt that his men were beginning
to waver, and, like a skilful commander, drew them off into a dry
place flanked by a marsh, and a wood where his artillery were
posted. The advantage of their position, and the time they had to
recover their spirits, restored the Swedes’ courage. Charles attacked
at once with 15,000 men, while the Duke had about 12,000. The
battle was hard fought and bloody; the Duke had two horses killed
under him; he three times penetrated into the centre of the King’s
guards, but at last, having been unhorsed by a musket blow, his
army fell into confusion, and he disputed the field no longer. His
cuirassiers carried him off from the thick of the battle with difficulty,
all bruised, and half dead, from the horses’ feet, as they were
trampling him.
After the victory the King of Sweden hastened to Mittau, the
capital of Courland, and took it. All the towns of the Duchy
surrendered at discretion; it was rather a triumphal passage than a
conquest. He passed rapidly on to Lithuania, and conquered
wherever he passed. And he acknowledged that it was a great
satisfaction to him to enter in triumph the town of Birzen, where the
King of Poland and the Czar had plotted his ruin. It was here that he
planned to dethrone the King of Poland by the agency of the Poles
themselves. When one day he was at table, quite absorbed in the
thought of his enterprise, and observing his usual rule of abstinence
in the midst of a profound silence, appearing engrossed in his great
plans, a German colonel, who was present, said loud enough for the
King to hear, that the meals which the Czar and the King of Poland
had made in the same place were very different from these.
“Yes,” said the King, rising, “and I shall the more easily disturb
their digestions.” In fact, using a little diplomacy to assist his arms,
he did not delay to prepare for the event about which he had been
busy thinking.
The Government of Poland is an almost exact image of the old
Celtic and Gothic Government, which has been altered almost
everywhere else. It is the only state which has retained the name
“republic,” with the royal dignity.
Every nobleman has the right to vote at the election of the king,
and to stand for election himself. These fine privileges have
corresponding abuses; the throne is almost always put up for sale,
and as a Pole is seldom rich enough to buy it, it is often sold to
foreigners. The nobility defend their liberty against the king, and
tyrannize over the rest of the nation. The body of the people are
slaves; such is the fate of mankind, that the great majority are, in
some way or another, kept under by the minority. There the peasant
does not sow his crops for himself but for his lord, to whom he and
his land and his very work belong, and who can sell him, or cut his
throat as if he were a beast of the field. A lord is answerable to none
but himself. Judgment can only be given against him for a criminal
action by an assembly of the whole nation.
Nor can he be arrested until after his condemnation, so that he is
hardly ever punished. Many among them are poor, in which case
they let themselves out to the richer, and do the basest duties for a
salary. They would rather serve their equals than engage in trade,
and while taking care of their masters’ horses they call themselves
electors of kings and destroyers of tyrants.
Whoever saw a King of Poland in the pomp of his majesty, would
think him the most absolute prince in Europe; yet he is certainly the
least so. The Poles really make with him the same contract which is
supposed to exist between a sovereign and his subjects. The King of
Poland at the moment of his consecration, and when he swears to
keep the “pacta conventa,” releases his subjects from their oath of
allegiance if he should break the laws of the republic. He nominates
to all public offices, and confers all honours. Nothing is hereditary in
Poland, except estates and noble rank. The sons of a count or of a
king have no claim to the dignities of their father. But there is this
great difference between the king and a republic, that he cannot
deprive of any office after having conferred it, and that the republic
may depose him if he breaks the constitution.
The nobility, jealous of their liberty, often sell their votes and
seldom their affections. They have scarcely elected a king before
they fear his ambition and make plots against him. The great men
whose fortunes he has made, and whom he cannot degrade, often
become his enemies instead of remaining his favourites; and those
who are attached to the Court, become objects of hatred to the rest
of the nobility. This makes the existence of two parties the rule
among them; a condition which is inevitable, and even a necessity, in
countries where they will have kings and at the same time preserve
their liberty. What concerns the nation is regulated by the States-
General, which they call Diets. These Diets are by the law of the
kingdom to be held alternately in Poland and Lithuania. The deputies
do business there with sword in hand, like the old Sarmatæ, from
whom they are descended; and sometimes too in a state of
intoxication, a vice to which the Sarmatæ were strangers. Every
nobleman deputed to these States-General has the right the Roman
tribunes had of vetoing the laws of the Senate. One nobleman, by
saying “I protest,” can put a stop to the unanimous resolutions of all
the rest; and if he leaves the place where the Diet is held they are
obliged to separate.
To the disorders arising from this law they apply a remedy still
more dangerous. There are almost always two factions in Poland; as
unanimity in the Diet is almost impossible, each party forms
confederacies, in which decisions are made by the majority’s votes,
without regard to the minority.
These assemblies, which are unconstitutional but authorized by
precedent, are held in the king’s name, though often without his
consent and against his interests, much in the same way as the
League in France made use of Henry III’s name to undermine his
power, or as the Parliament in England, which executed Charles I,
began by putting the King’s name at the head of all the Acts they
passed to destroy him. When the troubles are ended, then it is the
function of the General Diets to annul the acts of these cabals; any
Diet can also repeal the acts of its predecessors, because one king
can abolish the laws of his predecessors, or his own laws.
The nobility which makes the laws for the State is also its
defence. They muster on horseback on great occasions, and can
make a corps of more than 100,000 men. This great body, called
“Pospolite,” moves with difficulty, and is ill-governed. Difficulties of
provisions and forage make it impossible for them to keep together
long; they lack discipline, experience and obedience, but their strong
love of liberty makes them always formidable. They may be
conquered, dispersed, or even kept for a time in bonds, but they
soon shake off the yoke; they compare themselves to reeds, which a
storm will bend to the ground, and which will rise when the wind
drops. It is for this reason that they have no fortified towns—they
themselves are to be the only bulwarks of the State; they never let
their king build fortresses, lest he should use them rather for their
oppression than for their defence; their country is quite open, except
for two or three frontier towns, and if in any of their wars, civil or
foreign, they resolve to sustain a siege, they are obliged to hastily
raise earth fortifications, repair old half-ruined walls, and enlarge the
half-choked ditches; then the town is taken before the
entrenchments are finished.
The Pospolite is not always on horses to guard the country; they
only form by order of the Diet, or, in times of great danger, by that of
the king.
The ordinary protection of Poland is in the hands of a force which
the State is obliged to support. It is composed of two bodies
independent of each other under two different generals. The two
generals are independent of each other, and though they are
nominated by the king, are responsible to the State alone and have
supreme authority over their troops. The colonels are absolute
masters of their regiments, and it is their affair to get them what
sustenance they can, and to pay them; but as they are seldom paid
themselves, they ravage the country, and ruin the farmers to satisfy
their own rapacity, and that of their soldiers. The Polish lords appear
in these armies with more magnificence than in civil life, and their
tents are finer than their houses. The cavalry, which makes up two-
thirds of the army, is almost entirely composed of noblemen, and is
remarkable for the gracefulness of the horses and the richness of the
accoutrements.
Their men-at-arms especially, who are called either hussars or
pancernes, are always attended by several valets, who lead their
horses, which have ornamented bridles with plates of silver and
silver nails, embroidered saddles, saddle-bows and gilt stirrups,
sometimes made of massive silver, with saddle-cloth trailing in the
fashion of the Turks, whose magnificence the Poles imitate as nearly
as possible.
But though the cavalry is so gorgeous the foot are wretched, ill-
clad, ill-armed, without uniform clothes or anything regular; at least
that is how they were up to 1710. These foot-soldiers, who are like
wandering Tartars, bear hunger, cold, fatigue, and all the hardship of
war with incredible endurance. The characteristics of the ancient
Sarmatæ, their ancestors, can still be seen in the Poles; the same
lack of discipline, the same fury in assault, the same readiness to run
away and to return to the field, the same mad fury of slaughter when
they are victorious.
The King of Poland at first consoled himself with the idea that
these two armies would fight for him, that the Polish Pospolite would
arm at his orders, and that all these forces, united with his Saxon
subjects and his Russian allies, would make up a multitude before
whom the small Swedish force would not dare to appear. But he saw
himself suddenly deprived of this means of succour through the very
pains which he had taken to have them all at once.
Accustomed in his hereditary dominions to absolute power, he
was perhaps too confident that he could govern Poland like Saxony.
The beginning of his reign raised malcontents, his very first acts
irritated the party which was opposed to his election, and alienated
almost all the rest. The Poles resented the fact that their towns were
filled with Saxon garrisons and their frontiers with troops. The nation,
far more anxious to maintain their own liberties than to attack their
neighbours, did not consider the king’s attack on Sweden and his
invasion of Livonia as advantageous to the State. It is difficult to
deceive a free nation concerning its interests. The Poles saw that if
this war, undertaken against their wishes, was unsuccessful, their
country, unprotected on every side, would fall a prey to the King of
Sweden, and that if it succeeded they would be subdued by their
own king, who as soon as he was master of Livonia as well as
Saxony would be able to hem in Poland between these two
countries.
In the face of this alternative, of either being enslaved by the king
whom they had elected, or of having their land ravaged by Charles
who was justly enraged, they raised a great outcry against a war
which they believed was rather declared against themselves than
against Sweden. They regarded the Saxons and the Russians as the
instruments of their bondage. And when the King of Sweden had
overcome all that opposed him, and was advancing with a victorious
army into the heart of Lithuania, they opposed the King violently, and
with the more freedom because they were in misery.
Lithuania was then divided into two parties, that of the Princess
Sapieha, and that of Oginski. These two factions had begun by
private quarrels, and degenerated into civil war.
The King of Sweden was on the side of the Princess Sapieha;
and Oginski, ill supported by the Saxons, found his party almost
destroyed. The Lithuanian army, which these troubles and lack of
money was reducing to a small number, was partly dispersed by the
conqueror. The few who sided with the King of Poland were small
bodies of wandering troops, who lived by spoil. So that Augustus
found nothing in Lithuania but the weakness of his own party, the
hate of his subjects, and a foreign army led by an offended,
victorious and implacable king.
There was certainly an army in Poland, but instead of 38,000
men, the number prescribed by law, there were not 18,000. Then it
was not only ill-armed and ill-paid, but the generals were undecided
on any course of action. The King’s best course was to command
the nobility to follow him; but he dare not run the risk of a refusal,
which would increase his weakness by disclosing it.
In this state of trouble and uncertainty, all the counts and dukes
demanded a Parliament of the King, just as in England, in times of
crisis, the different bodies of the State present addresses to the King
beseeching him to call a Parliament. Augustus was more in need of
an army than of a Parliament where the actions of kings are
criticized. But he was forced to call one, that he might not provoke
the nation irretrievably. A Diet was therefore summoned to meet at
Warsaw, on the 2nd of December, 1701. He soon saw that Charles
XII had as much influence in the Assembly as he had himself. The
party of the Sapieha, the Lubomirski, and their friends, Count
Leczinski, treasurer of the crown, who owed his fortune to King
Augustus, and above all the partisans of the Sobieski, were all
secretly for the King of Sweden.
The most influential of them, and the most dangerous enemy that
the King of Poland had, was Cardinal Radjouski, archbishop of
Gnesna, primate of the kingdom and president of the Diet; his
conduct was full of duplicity and artifice, and he was entirely
dominated by an ambitious woman whom the Swedes called
Madame la Cardinale, and who never ceased to urge him to intrigue
and faction. King John Sobieski, Augustus’s predecessor, had first
made him archbishop of Varmia and vice-chancellor of the kingdom.
By favour of the same Prince, the Bishop got a Cardinal’s hat; this
dignity soon opened his way to the primacy, and thus uniting in his
person all that impresses people, he was able to undertake great
enterprises with impunity.
On the death of John he exerted his interest to place Jacques
Sobieski on the throne; but the great hate they bore the father, great
as he was, led to the rejection of the son. Then the Cardinal-Primate
united with the Abbé Polignac, ambassador from France, to give the
crown to the Prince of Conti, who actually was elected.
But the money and the troops of the Saxons got the better of him.
At last he allowed himself to be drawn into the party which crowned
the Elector of Saxony, and waited impatiently for a chance of sowing
dissension between the nation and the new king.
The victories of Charles XII, protector of Prince James Sobiesky,
the civil war in Lithuania, the general dissatisfaction of all his people
with King Augustus, made the Cardinal-Primate hope that the time
had come when he might send Augustus back into Saxony, and
open the way to the throne for Prince John. This Prince, who had
formerly been the innocent object of the Poles’ hatred, was
beginning to be their idol, in proportion as King Augustus lost their
favour; but he dare not even conceive such a revolution, of which the
Cardinal had insensibly laid the foundations.
At first he seemed to wish to reconcile the King with the republic.
He sent circular letters apparently dictated by the spirit of concord
and charity, a common and well-known snare, but one by which men
are always caught; he wrote a touching letter to the King of Sweden,
imploring him, in the name of Him whom all Christians adore, to give
peace to Poland and her King. Charles XII answered the Cardinal’s
intentions rather than his words, for he remained with his victorious
army in the Grand Duchy of Lithuania, declaring that he had no
desire to disturb the Diet, that he was making war on Augustus and
the Saxons, and not on Poland, and that far from attacking the State
he had come to save it from oppression. These letters and answers
were for public perusal. The springs which made the Diet act were
the emissaries, who continually came and went between the
Cardinal and Count Piper, and the private meetings held at this
prelate’s house. They proposed to send an embassy to Charles XII,
and were unanimous in their demands that their King should not call
in the aid of any more Russians, and that he should send his Saxon
troops away.
Augustus’s bad luck had already brought about what the Diet
asked him. The treaty made secretly with the Russians at Birzen had
turned out to be as useless as it had seemed formidable. He was far
from being able to send the Czar the 15,000 men he had promised
to raise in the Empire.
The Czar himself, a dangerous enemy of Poland, was not at all
anxious at that time to help a divided kingdom, hoping to have some
share in the spoils. He contented himself with sending 20,000
Russians into Lithuania, and they did more mischief than the
Swedes, fleeing continually before the conqueror, and ravaging
Polish territory, till at last, being chased by the Swedish generals and
finding nothing else to ravage, they returned in bands to their own
country. As to the scattered remains of the Saxon army which had
been beaten at Riga, King Augustus sent them to winter and recruit
in Saxony, that this sacrifice might regain him the affections of the
Polish nation in his present difficult position.
Then the war was abandoned for a series of intrigues, and the
Diet divided into almost as many factions as there were dukedoms.
One day the interests of King Augustus were paramount, the next
they were rejected. Everybody clamoured for liberty and justice, yet
they had no conception of either; the time was spent in secret cabals
and public debate. The Diet knew nothing about what they might or
should do; great assemblies seldom agree on good measures in
time of civil uproar, because bold men in such assemblies are
generally factious, while more reliable men are usually timid.
The Diet broke up in disorder on the 17th of February, 1702, after
three months’ plotting and irresolution. The senators, that is, the
dukes and the bishops, remained at Warsaw. The Polish Senate has
the right of making laws provisionally, which the Diets seldom
disannul; this body, much less cumbrous and more used to business,
was far less disturbed, and quickly came to a resolution.
They agreed to send the embassy proposed in the Diet to the
King of Sweden, and also that the Pospolite should mount and hold
themselves ready for any emergency. They also made several
regulations to appease the troubles in Lithuania, and still more to
diminish the King’s authority, though it was less to be feared than
Charles’s.
Augustus preferred to receive hard conditions from his conqueror
than from his subjects; he therefore determined to sue for peace with
the King of Sweden, and was on the point of negotiating with him. He
was obliged to keep this step secret from the Senate, whom he
regarded as a still more implacable foe. As the affair was difficult he
intrusted it to the Countess of Königsmarck, a Swedish lady of high
rank to whom he was then attached. This lady, who was celebrated
throughout the world for her wit and beauty, was more capable than
any minister of bringing a negotiation to a successful issue. Besides,
as she had some property in Charles’s dominions, and had been
long a member of his Court, she had a plausible reason for waiting
on the Prince. She came then to the Swedish camp in Lithuania, and
first applied to Count Piper, who too lightly promised her an audience
of his master.
The Countess, among the talents which made her one of the
most delightful persons in Europe, had a gift for speaking several
languages like a native, and would sometimes amuse herself by
making French verses which might have been written at Versailles.
She made some for Charles XII. She introduced the gods of
antiquity, praising his different virtues, and ended as follows—
All her wit and charm were lost on such a man as the King of
Sweden; he obstinately refused to see her. She planned to intercept
him when he was taking his usual horse-exercise. Thus meeting him
one day in a very narrow lane she alighted as soon as she saw him.
The King bowed without a word, turned his horse and rode straight
back. So that the only satisfaction the Countess got from her journey
was the conviction that she was the only person of whom the King
was afraid.
The King of Poland was then obliged to throw himself into the
arms of the Senate. He made them two proposals by means of the
Count of Mariemburg; either that they should leave him the control of
the army, which he would pay two quarters in advance out of his own
pocket, or else that they should allow him to bring 12,000 Saxons
into Poland. The Cardinal replied as severely as the King of Sweden
had done. He told the Count of Mariemburg, in the name of the
Assembly, “That they had decided to send an embassy to Charles
XII, and that it was not his affair to introduce Saxons.”
In this extremity the King was anxious to preserve at least a
semblance of royal authority. He sent one of his chamberlains to
Charles to inquire when and how his Swedish Majesty would receive
the embassy of the King, his master, and of the State. Unfortunately
they had neglected to provide this messenger with a passport; so
Charles threw him into prison, with the remark that he was waiting
for an embassy from the State, and none from King Augustus.
Then Charles, leaving garrisons behind him in some of the
Lithuanian towns, advanced to Grodno, a town famous in Europe for
the Diets held there, but ill-built and worse fortified. Some miles
away from Grodno he met the embassy sent by the Polish State.
Charles XII received them in his tent with some display of military
pomp; their proposals were full of evasion and obscurity, they
seemed afraid of Charles, and disliked Augustus, but they were
ashamed of deposing a king whom they had elected at the order of a
foreigner. Nothing was settled, and Charles gave them to understand
that he would give them a decision at Warsaw.
His march was preceded by a manifesto which the Cardinal and
his party spread over Poland in eight days. By this document
Charles invited all the Poles to join him in vengeance, pretending
that their interests were the same. They were, as a matter of fact,
very different, but the manifesto, seconded by a great party, by
disorder in the Senate and by the approach of the conqueror, made
a great impression. They were obliged to own Charles for a
protector, since it was his will, and it was well for them that he was
content with this title. The Senators who were opposed to Augustus
advertised the manifesto in his very face, and those who were on his
side kept silence. At last when they heard that Charles was
advancing by forced marches, they all took panic, and prepared to
flee. The Cardinal was one of the first to leave Warsaw, the majority
hastened to flee, some to await the issue of affairs on their own
estates, some to arm their adherents. With the King there remained
only the Imperial and Russian ambassadors, the Pope’s Legate, and
some few bishops and counts, who were attached to him. He was
forced to flee, and nothing had yet been decided in his favour. Before
his departure, he hastened to take counsel with the small number of
Senators who remained. But though they were anxious to serve him
they were still Poles, and had all got so great an aversion for Saxon
troops, that they dare not allow him to bring 6,000 men for his
defence, and they further voted that these 6,000 men should be
commanded by the Grand Duke of Poland, and immediately sent
back after peace had been made. As to the armies of the republic,
they put them at his disposal.
After this settlement the King left Warsaw, being too weak to
oppose the enemy, and little satisfied with his own party. He at once
published his orders for assembling the Pospolite and the armies,
which were little more than a name.
There was nothing to be hoped from Lithuania, where the
Swedes were posted; while the Polish army, reduced in number,
lacked arms, provisions and the will to fight. The majority of the
nobles, intimidated, undecided, or disaffected, stayed on their own
lands. It was in vain that the King, authorized by law, ordered every
noble to appear on horseback under pain of death, and to follow him;
they began to argue that they need not obey him. His chief trust was
in the troops of the Electorate, where, as the form of government
was absolute, he did not fear disobedience. He had already given
orders to 2,000 Saxons, who were marching rapidly. He also recalled
8,000, which he had promised to the Emperor for the French war, but
which in his difficult position he was forced to withdraw. The
introduction of so many Saxons into Poland meant the provocation of
general disaffection, and the violation of the law made by his own
party, allowing him a force of only 6,000. But he realized that if he
were victor they would not dare to complain, while if he were beaten
they would never forgive the introduction of 6,000 men. While his
soldiers were arriving in groups, and he was passing from county to
county collecting the nobles who adhered to him, the King of
Sweden at last arrived before Warsaw on the 5th of May, 1702. The
gates were opened to him at the first summons; he sent away the
Polish garrison, disbanded the militia, set up military posts of his own
everywhere, and ordered the inhabitants to disarm; then content with
that, and not wishing to exasperate them, he only demanded a
tribute of 100,000 livres. King Augustus was at that time assembling
his forces at Cracow, and was very surprised to see the Cardinal-
Primate among them. This man wished, perhaps, to maintain an
external reputation to the last, and to dethrone his King with every
mark of outward respect. He gave him to understand that the King of
Sweden would grant reasonable terms, and humbly asked
permission to go to see the King. King Augustus granted what he
was powerless to refuse, and so left him free to do him an injury. The
Cardinal hastened immediately to see the King of Sweden, to whom
he had not yet ventured to present himself. He met the Prince at
Prague, not far from Warsaw, but without the ceremony which had
been shown towards the ambassadors of the State.
He found the conqueror clad in a dress of coarse blue cloth with
brass buttons, jack-boots, and buffalo-skin gloves reaching to the
elbow, in a room without hangings, together with the Duke of
Holstein, his brother-in-law, Count Piper, his prime minister, and
several officers. The King came forward to meet the Cardinal, and
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookfinal.com